How to use UpdatePanel in gridview?

1

I have a grid and I want to make it not give postback when clicked on some boundfield (those action buttons). I did it this way, but it always refreshes 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>
    
asked by anonymous 06.06.2015 / 04:47

1 answer

1

Change the attribute ChildrenAsTriggers to false .

This attribute causes all child controls to cause PostBack .

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

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

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

 meuUpdatePanel.Update();    
    
06.06.2015 / 17:10