Wednesday, March 28, 2012

UpdatePanel - need synchronous postback from child button

I have several buttons in UpdatePanel and I want one the button to cause synchronous postback. It may sound strange but without going into details - I need the button within UpdatePanel and I need this button to cause sync postback. This button cannot be outside of UpdatePanel.

I tried settingChildrenAsTriggers="false"UpdateMode="conditional"but that still causes async postback when the button is clicked - ScriptManager.IsInAsyncPostBack returns "true".

How can I get around it?

thanks,

-Stan

Hi There,

You can make use of trigger in your updatepanel

example: Button1 is full postback

<asp:ScriptManagerID="ScriptManager1"runat="server">

</asp:ScriptManager>

<asp:UpdatePanelID="UpdatePanel1"runat="server">

<Triggers>

<asp:PostBackTriggerControlID="Button1"/>

</Triggers>

<ContentTemplate>

<asp:ButtonID="Button1"runat="server"Text="Button"/>

<asp:ButtonID="Button2"runat="server"Text="Button" /

</ContentTemplate>

</asp:UpdatePanel>


That's exactly what I need, thanks!

No comments:

Post a Comment