How to refresh a C # parent page from a popup page without a full refresh

Does anyone know how I can reload UpdatePanel on my C # parent page from an action on my popup page WITHOUT updating the entire parent page. My parent page does not save its state in the URL, so the user can expand the div here, update the list there and the state of the parent page needs to be saved. All that should happen is that the UpdatePanel containing the GridView "DomainObjects.Incident" should update / update when the user added a new popup file.

Is there a way to link events between two different asp.net pages? Or should I use javascript?

+3
source share
4 answers

You can update UpdatePanel by calling:

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

If you want to do this from a child page, you should be able to wrap the call in a function and call it using 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" />

Probably make sure that the parent is still open before calling Refresh () by checking the box "window.opener.closed".

I have not tested this code, so it could be type'o.

+1
source

The only way to do this is entirely controlled only by .net code if you use something like AjaxControlToolkit to make the popup a modal div on the main page.

javascript , / . postback/callback .

+3

window.opener

JQuery -

, , javascript, , javascript , , .

0

Source: https://habr.com/ru/post/1772964/


All Articles