I haven't touched ASP in a long time and I'm starting to remember why!
I have an update panel that contains a repeater, the repeater items contain a button and I want that button as an asynchronous post-back trigger for the update panel.
The update panel looks like this:
<asp:UpdatePanel runat="server" Visible="true" ID="pnlSproc" UpdateMode="Conditional" ChildrenAsTriggers="true">
<asp:Repeater runat="server" ID="rptParameters" EnableViewState="true" OnItemCreated="rptParameters_ItemCreated" >
<asp:Button runat="server" ID="btnAddParameter" />
The ItemCreated event of the repeater adds the button as an asynchronous trigger ...
protected void rptParameters_ItemCreated(object source, RepeaterItemEventArgs e)
ScriptManager manager = ScriptManager.GetCurrent(this);
Button button = (Button)e.Item.FindControl("btnAddParameter");
if (button != null)
button.Click += AddParameterClick;
When the event fires, all the appropriate events fire as expected but the panel is rendered twice - once in its updated form (higher up the page than it should be) and once in its original form and position.
If I change the RegisterAsyncPostBackControl call to RegisterPostBackControl everything works as I would expect it to but obviously I get a full page postback which I don't want.
Has anyone come across anything similar before? It certainly looks like it's the async postback that's causing the rendering problem (it occurs in both IE and Chrome and my mark-up looks completely valid. I've tried moving the script manager from the page to the master and that has no effect, either.