ASP.NET 从一个窗口刷新另一个窗口
我有一个带有 GridView 的页面,它使用 Javascript 启动弹出窗口。 然后,用户选择一个项目,该项目将更新连接到 GridView 的数据并关闭弹出窗口。
如何刷新第一个(即调用页面)以便刷新 Gridview 中显示的数据?
I have a page with a GridView on it that launches a popup, using Javascript. The user then selects an item, that updates the data connected to the GridView and closes the popup.
How do I refresh the first (ie the Calling page) so that I can refresh the data shown in my Gridview?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在弹出窗口中尝试此操作:
这应该刷新打开弹出窗口的页面
Try this inside your popup:
That should refresh the page that opened the pop-up
如果您只需要在调用页面上触发回发,这应该可行:
通过显式提交表单,您可以避免在刷新调用页面时出现的警告。
如果您需要在回发期间触发 GridView 上的 OnSelectedIndexChanged 事件,那么事情会有点复杂,但您应该能够通过使用合适的调用
window.parent.document.__doPostBack()
来完成此操作论据。If you simply need to trigger a postback on the calling page, this should work:
By explicitly submitting the form, you avoid the warning that appears if you just refresh the calling page.
If you need to trigger an OnSelectedIndexChanged event on the GridView during the postback, then things are a bit fiddlier, but you should be able to do it by calling
window.parent.document.__doPostBack()
with suitable arguments.解决方案如下:
在 .NET 2.0 中,您必须将其添加到页面中以在 Javascript 之上注册:
Here is the Solution:
In .NET 2.0 you have to add this to the page to register above Javascript:
这是否可以避免“页面无法刷新”消息
(抱歉,我只是在 TonyB 的帖子上发表评论,但我没有足够的 SO 积分,所以我不被允许......:(
Does this avoid the 'page cannot be refreshed' message
(sorry I would have just left a comment on TonyB's post but I don't have enough SO points, so I'm not allowed... :(