0

I've been trying to add/remove controls to an updatepanel when updating it. Those controls are dynamically filled depending on the info in the page session.

The Updatepanel_Load event is triggered correctly but the controls I've changed won't show properly. They'll only show after a full postback!

Now I know that you need an onInit event to add / alter controls on the page but is this also necessary for an updatepanel? Can someone please explain the right order to do this?

ORDER RIGHT NOW:

  • Button click
  • LoginProcedure over ajax
  • OnInit
  • UpdatePanel1_Load (Generates controls)
  • onInit.

So no controls are added / altered until full post back. What is the correct order / method to add / alter controls within an updatepanel without a full postback?

gunr2171
  • 16,104
  • 25
  • 61
  • 88
Jeroen Vorsselman
  • 803
  • 1
  • 9
  • 19
  • A short search on google gave me the following result: http://stackoverflow.com/questions/553073/adding-controls-dynamically-to-an-updatepanel-in-asp-net-ajax – RononDex Nov 29 '13 at 10:21

1 Answers1

0

add async postback to your updatePanel like:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Init..."></asp:Label>
</ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="TextBoxTrigger" EventName="TextChanged" />
    </Triggers>
</asp:UpdatePanel>
Amer Zafar
  • 419
  • 2
  • 11
  • Adding a trigger has nothing to do with the thread synchronization between a handler and the page loading. i need the page load to wait until the external handler is complete. – Jeroen Vorsselman Nov 29 '13 at 14:19