ASP.NET GridView RowIndex As CommandArgument

Here is a very simple way:

<asp:ButtonField ButtonType="Button" CommandName="Edit" Text="Edit" Visible="True" 
                 CommandArgument="<%# Container.DataItemIndex %>" />

Leave a Comment