C# getting GridView DataKeyNames values when editing event execute
Last modified: July 01, 2021<asp:GridView ID="GridViewMovie" OnRowEditing="GridViewMovie_RowEditing" DataKeyNames="Id" AutoGenerateColumns="False" runat="server">
<Columns>
<asp:CommandField ButtonType="Button" HeaderText="Edit" ShowEditButton="True" ShowHeader="True" />
</Columns>
</asp:GridView>
protected void GridViewMovie_RowEditing(object sender, GridViewEditEventArgs e)
{
var id = GridViewMovie.DataKeys[e.NewEditIndex].Value.ToString();
}