Showing posts with label causing. Show all posts
Showing posts with label causing. Show all posts

Wednesday, March 21, 2012

UpdatePanel causing non async postback

Hi.

I'm trying to wire up a page with a control in it using ajax and update panels, but each time I try the whole page is posted back. Obviously there's something I'm missing.

So this is what I have:

Home.aspx -> (containing) myControl.ascx

myControl.ascx is a datagrid wrapped with an updatepanel

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><asp:UpdatePanel ID="UpdatePanel1" runat="server" EnableViewState="true" ChildrenAsTriggers="true" UpdateMode="Conditional"> <ContentTemplate> /* myDatagrid here */ </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="myDatagrid" /> </Triggers></asp:UpdatePanel>

The whole page (home.aspx) is posted back when one of the edit / update columns in the datagrid is pressed.
Please help

If you want to specify asynchronous post back for a control, you should specify the corresponding event name at the same time. Here are some sample codes for your reference.
<asp:ScriptManager ID="ScriptManager1" runat="server"EnablePartialRendering="true">
</asp:ScriptManager>
<asp:UpdatePanel ID="upnlGridView0" runat="server"ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="gv" runat="server" OnRowCommand="gv_RowCommand"></asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="gv" EventName="RowCommand" />
</Triggers>
</asp:UpdatePanel
Wish the above can help you.