以另一种形式访问Gridview [英] Accessing Gridview In Another Form

查看:86
本文介绍了以另一种形式访问Gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个按钮,可以使用按钮单击和javascript函数打开这样的窗口

I have a button that opens a window like such using a button click and a javascript function

展开 | 选择 | Wrap | 行号

推荐答案

是的,但是它不是很漂亮。

你需要使用JavaScript window.opener 访问父窗口(请注意,出于某种原因,您必须为子窗口指定一个名称才能使用此窗口)。如果window.opener不为null,那么您可以在子窗口中使用它来在执行行选择的父窗口中调用JavaScript函数。


:)


-Frinny
Yup there''s a way but it''s not pretty.
You need to use the JavaScript window.opener to access the parent window (Please note that for some reason you have to give the child window a name in order to use this). If the window.opener is not null, then you can use it in the child window to call a JavaScript function in the parent window that does the row selection.

:)

-Frinny


这意味着我会用window.opener打开弹出窗口,这样我就可以将值返回给父母了?此外,我正在阅读,因为gridviews被更改为表格......很难通过JS更改所选索引。这是真的吗?
so that would mean i would open the popup window with window.opener so I can return values to the parents? Also I was reading that because gridviews are changed into tables...its really hard to change the selected index via JS. Is this true?


不完全。

您可以像打开子窗口一样打开子窗口。

在子窗口中你将有一个JavaScript方法,使用window.opener访问父窗口。您可以使用window.opener属性从子窗口调用父窗口中的JavaScript方法。


因此,这意味着您需要在父窗口中添加一个接受选择行所需的值。


当子窗口的选定行发生更改时,您调用父窗口JavaScript方法(使用window.opener)...将值传递给它。


通过JavaScript更改所选索引并不是那么困难......需要一些思考,不要误会我的意思......我已经用JavaScript完成了GridView行操作在过去。我想这确实需要一段时间来弄明白,但这就是开发人员的全部意义:)


-Frinny
Not quite.
You would open the child window just like you are.
In the child window you would have a JavaScript method that uses the window.opener to access the parent window. You can call JavaScript methods in the parent window from the child window using the window.opener property.

So this means that you need to add a JavaScript method in the parent window that accepts the values that are required for selecting the row.

When the child window''s selected row changes, you call the parent windows JavaScript method (using the window.opener)...passing it the values.

It''s not really that difficult to change the selected index via JavaScript...it takes some thinking, don''t get me wrong...I''ve done GridView row manipulation with JavaScript in the past. I guess it did take me a while to figure out but that is what being a developer is all about :)

-Frinny


这篇关于以另一种形式访问Gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆