How to use Updatepanel in gridview?

Asked

Viewed 676 times

1

I have a grid and I want to make it not give postback when clicked on any boundfield (those stock buttons). I did so below, but always updates the page.

    <asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true" >
            <ContentTemplate>
                <asp:GridView ID="GridView" runat="server" .. ETC />
                <Columns>
                <asp:ButtonField ButtonType="Image" CommandName="Excluir" />                
                </Columns>
               </asp:GridView>
    </ContentTemplate> 
</asp:UpdatePanel>
  • Why do you wear UpdateMode="Conditional"?

1 answer

1

Change the attribute ChildrenAsTriggers for false.

This attribute causes all child controls to cause the PostBack.

If you need some specific control to be used as a trigger, configure it as follows:

<Triggers>
     <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>

Or, if you want to have a more refined control of when Updatepanel should be updated, in codebehind call:

 meuUpdatePanel.Update();    

Browser other questions tagged

You are not signed in. Login or sign up in order to post.