Bhupendra Singh

Bhupendra Singh

  • NA
  • 225
  • 148.7k

How to find Grid view row index value using command argument on button click

Oct 4 2012 11:39 AM

<asp:TemplateField HeaderText="DELETE" HeaderStyle-CssClass="sfDelete">
                        <ItemTemplate>
  <asp:ImageButton ID="imbDelete" runat="server" CausesValidation="False" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
                                CommandName="Delete"   ToolTip="Delete the enquiry" />
</ItemTemplate>
                                </asp:TemplateField>


Fire Event of grid view row Command..
-------------------------------------------------------------------------------------------------------

protected void gdvRecord_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        
        if (e.CommandName == "EDIT")
        {
            int RowNum = int.Parse(e.CommandArgument.ToString());
}

}

Answers (1)