views:

90

answers:

2

I would like an UpdatPanel to update it's content once a button is clicked - this button is contained within a UserControl placed on the webpage.

However, I cannot just simply reference it using the AsyncPostBackTrigger's ControlID property, because the button is not situated directly on the webpage.

Is there any way to reference it to the AsyncPostBackTrigger?

+1  A: 

Use RegisterAsyncPostbackControl, e.g. if you have a user control UserControl1 containing Button1 and your script manager is called ScriptManager1:

ScriptManager1.RegisterAsyncPostbackControl(UserControl1.FindControl("Button1"));

Edit:

This will refresh all update panels, except panels that have their property set to conditional. For these panels you need to call UpdatePanel.Update(); in the code for the button.

Residuum
Hmm for which UpdatePanel (assuming I have more than one on page, which is the case) does this register the trigger? It doesn't have any parameters to point to the right UpdatePanel, and there is only one ScriptManager for the entire webpage...
Aaalf
@Aaaalf: see my edit.
Residuum
A: 

Does the user control expose the button as a child control? If not can it? If not then you can use FindControl on the user control to find the inner button.

ck