javascript - How can I update a c# parent page from a pop-up page without a full refresh - Stack Overflow

Does anyone know how I can reload an UpdatePanel on my parent C# page from an action on my pop-up page

Does anyone know how I can reload an UpdatePanel on my parent C# page from an action on my pop-up page WITHOUT refreshing the entire parent page. My parent page doesn't retain its state in the Url, so the user may have expanded a div here, refreshed a list there, and that parent page state needs to be preserved. All that needs to happen is that an UpdatePanel containing a GridView of 'DomainObjects.Incident' should update/refresh when the user has added a new incident in the pop-up.

Is there a way to wire up events between two different asp pages? Or should I be using javascript?

Does anyone know how I can reload an UpdatePanel on my parent C# page from an action on my pop-up page WITHOUT refreshing the entire parent page. My parent page doesn't retain its state in the Url, so the user may have expanded a div here, refreshed a list there, and that parent page state needs to be preserved. All that needs to happen is that an UpdatePanel containing a GridView of 'DomainObjects.Incident' should update/refresh when the user has added a new incident in the pop-up.

Is there a way to wire up events between two different asp pages? Or should I be using javascript?

Share Improve this question asked Nov 4, 2010 at 2:13 Ralph LavelleRalph Lavelle 5,7694 gold badges39 silver badges47 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 3

The only way to do this pletely managed only by code is if you use something like the AjaxControlToolkit to make your popup a modal div in the main page.

Otherwise, you could use javascript in the child and parent page to trigger some postback/callback in the parent page. You can set the postback/callback event as a trigger of your update panel.

You can refresh an UpdatePanel by calling:

__doPostBack('<UpdatePanel ID>', '');

If you want to do this from the child page, you should be able to wrap the call up in a function and call it via JavaScript.

Example:

// Parent Page Refresh Function
function Refresh()
{
    __doPostBack('UpdatePanel1', '');
}

//Child Page Trigger
<input type="button" id="button1" onclick="window.opener.Refresh()" value="Refresh Parent" />

You should probably make sure the parent is still open before calling Refresh() by checking "window.opener.closed".

I've not tested this code, so might have a type'o.

Have a look at window.opener

Reference parent window document

JQuery - Write to opener window

My first thought is municate to the parent window to perform the refresh using javascript, you could see what javascript your update panel calls via the page source and use the same.

If there is a chance to use the RadWindow(telerik), then the munication is possible between the parent and the child page.

see the demo http://demos.telerik./aspnet-ajax/window/examples/dialogreturnvalue/defaultcs.aspx

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745568058a4633514.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信