<p>I have some code that modifies a value that several controls in other update panels are bound to. When this event handler fires, I'd like it to force the other update panels to refresh as well, so they can rebind.</p>

<p>Is this possible?</p>

<p>Edit: </p>

<p>To clarify, I have an update panel in one user control, the other update panels are in other user controls, so they can't see each other unless I were to expose some custom properties and use findControl etc etc...</p>

<p>Edit Again:</p>

<p>Here is what I came up with:</p>

<pre><code>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);
        }
    }
}
</code></pre>

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

<p>In my triggering control, I just cast this.Page into the currentpage and called Update.</p>

<p>Edit:</p>

<p>AARRGGGG!</p>

<p>While the update panels refresh, it does not call Page_Load within the subcontrols in them...What do I do now!</p>

[{'answer_id': 55300, 'author': 'Dale Marshall', 'author_id': 1491425, 'author_profile': 'https://Stackoverflow.com/users/1491425', 'pm_score': 2, 'selected': False, 'text': '<p>You can set triggers on the events in the update panel you want updated or you can explicitly say updatepanel.update() in the code behind.</p>\n'}, {'answer_id': 55301, 'author': 'Dr Zimmerman', 'author_id': 4605, 'author_profile': 'https://Stackoverflow.com/users/4605', 'pm_score': 2, 'selected': False, 'text': '<p>What about registering a PostBackTrigger (instead of an AsyncPostBackTrigger) that will refresh every panel when a specific event fires.  </p>\n\n<p>Or add the trigger that already refreshes some UpdatePanels to the other UpdatePanels as well.</p>\n'}, {'answer_id': 55304, 'author': 'Gulzar Nazim', 'author_id': 4337, 'author_profile': 'https://Stackoverflow.com/users/4337', 'pm_score': 0, 'selected': False, 'text': '<p>This is a good technique if you want to refresh updatepanel from <a href="http://encosia.com/2007/07/13/easily-refresh-an-updatepanel-using-javascript/" rel="nofollow noreferrer">client side Javascript</a>.</p>\n'}, {'answer_id': 55442, 'author': 'Jacob Proffitt', 'author_id': 1336, 'author_profile': 'https://Stackoverflow.com/users/1336', 'pm_score': 0, 'selected': False, 'text': "<p>Page.DataBind() kicks off a round of databind on all child controls. That'll cause Asp.Net to re-evaluate bind expressions on each control. If that's insufficient, you can add whatever logic you want to make sure gets kicked off to an OnDataBinding or OnDataBound override in your usercontrols. If you need to re-execute the Page_Load event, for example, you can simply call it in your overridden OnDataBound method.</p>\n"}, {'answer_id': 23698230, 'author': 'ravenx30', 'author_id': 3515281, 'author_profile': 'https://Stackoverflow.com/users/3515281', 'pm_score': 0, 'selected': False, 'text': "<p>instantuate both view panels to a third presenter class, Then let the presenter class control both views. for example:</p>\n\n<p>You could just pass over what you need the 'middle class' to do its job for example, in your main you could have;</p>\n\n<pre><code>PresenterClass.AttachInterface(mIOrder);\nPresenterClass.DoSomeCalulation();\nPresenterClass.drawPanel(1);\nPresenterClass.AttachInterface(mIOtherOrder);\nPresenterClass.DoSomeCalulation();\nPresenterClass.drawPanel(2);\n</code></pre>\n\n<p>each view will have its own controls. So many differant ways you could do this.. alternitivly you could use the middle class to instantuate both your panels then in each of your panels you could have 'get methods' to retrive the data for processing.</p>\n"}]
['https://Stackoverflow.com/questions/55270', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1965/']