Refresh all update panels on the page?

I have code that changes a value that is associated with several controls in other update panels. When this event handler fires, I would like it to force other update panels to update again so that they can recover.

Is it possible?

Edit:

To clarify, I have an update panel in one user control, other update panels are in other user controls, so they cannot see each other unless I open some user properties and use findControl, etc. etc....

Change again:

Here is what I came up with:

public void Update() { recursiveUpdate(this); } private void recursiveUpdate(Control control) { foreach (Control c in control.Controls) { if (c is UpdatePanel) { ((UpdatePanel)c).Update(); } if (c.HasControls()) { recursiveUpdate(c); } } } 

I had 3 main user controls that were full of update panels, these controls were visible on the main page, so I added an update method there called Update on these three.

In my trigger control, I just ran this.Page into the current page and named Update.

Edit:

AARRGGGG!

When updating update panels, it does not call Page_Load inside the subcontrol in them ... What should I do now?

+4
source share
5 answers

How to register a PostBackTrigger (instead of AsyncPostBackTrigger), which will update each panel when a specific event occurs.

Or add a trigger that already updates some UpdatePanels for other UpdatePanels.

+3
source

You can set triggers in events on the update panel that you want to update, or explicitly specify updatepanel.update () in the code.

+2
source

This is a good technique if you want to update an updated panel with client Javascript .

0
source

Page.DataBind () starts the data binding round of all child controls. This will cause Asp.Net to re-evaluate the binding expressions for each control. If this is not enough, you can add any logic that you want to be able to disable it before overriding OnDataBinding or OnDataBound in your user controls. If you need to re-execute the Page_Load event, for example, you can simply call it in your overridden OnDataBound method.

0
source

set both view panels to the third class of the presenter. Then let the presenter class manage both views. eg:

You could just pass on what you need the “middle class” to do your job, for example, basically, you could:

 PresenterClass.AttachInterface(mIOrder); PresenterClass.DoSomeCalulation(); PresenterClass.drawPanel(1); PresenterClass.AttachInterface(mIOtherOrder); PresenterClass.DoSomeCalulation(); PresenterClass.drawPanel(2); 

each view will have its own controls. There are so many different ways you could do this: alternatively, you could use a middle class to customize both of your panels, then in each of your panels you could “get methods” to extract data for processing.

0
source

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


All Articles