Search code examples
asp.netvb.netupdatepanelaspxgridview

RowIndex attribute of templated field inside update panel


I want my templated buttons to have an update panel around it, but it messes up my rowindex attribute for the control. I tried to get the parent of the container but it says displayindex is not a property

<ItemTemplate>
    <asp:UpdatePanel runat="server">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="IBRemove" EventName="click" />
        </Triggers>
        <ContentTemplate>
             <asp:ImageButton ID="IBRemove" runat="server" RowIndex="<%#  Contanier.Parent.Displayindex %>"  OnClick="IBRemove_Click" />
        </ContentTemplate>
    </asp:UpdatePanel>
</ItemTemplate>

Solution

  • The Link that VDWWD commented worked fine and it makes more sense to wrap the entire gridview in the update panel.

    I was looking for this though:

    RowIndex="<%# (DirectCast(Container, IDataItemContainer)).DisplayIndex %>"