I'm not sure what your problem is. I've included a similar example that works just fine. If I were you, I'd strip down the page to the bare basics to isolate the problem or start a fresh page.
ASPX
<div style="margin-bottom: 20px;">
<asp:label id="lblEditMsg" runat="server" />
</div>
<asp:gridview id="gvProducts" runat="server" allowpaging="True" autogenerateeditbutton="true"
datakeynames="ProductID" datasourceid="sdsProducts" onrowediting="gvProducts_RowEditing" onrowcancelingedit="gvProducts_RowCancelingEdit">
</asp:gridview>
<asp:sqldatasource id="sdsProducts" runat="server" connectionstring="<%$ ConnectionStrings:NorthwindConnectionString %>"
selectcommand="SELECT * FROM [Products]">
</asp:sqldatasource>
CODE-BEHIND
protected void gvProducts_RowEditing(object sender, GridViewEditEventArgs e)
{
lblEditMsg.Text = String.Format("Row {0} being edited", e.NewEditIndex + 1);
lblEditMsg.Visible = true;
}
protected void gvProducts_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
lblEditMsg.Visible = false;
}
Thanks, Ed
Microsoft MVP - ASP/ASP.NET
Please remember to 'Mark as Answer' if this post answered your question!