Please place below code in your grid cancel event :
GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];
TextBox id = (TextBox)row.Cells[1].Controls[0];
var data = id.Text;
Response.Write("You cancelled the edit operation for employee with id: " + data);
GridView1.EditIndex = -1;
BindGrid();
Member
68 Points
240 Posts
Cell value is always empty in RowCancelingEdit event in GridView
Feb 04, 2019 03:27 AM|vinodkpasi|LINK
All-Star
18815 Points
3831 Posts
Re: Cell value is always empty in RowCancelingEdit event in GridView
Feb 04, 2019 05:14 AM|Nan Yu|LINK
Hi vinodkpasi ,
You can get the cell value by ;
Result :
Best Regards,
Nan Yu
All-Star
52813 Points
15767 Posts
Re: Cell value is always empty in RowCancelingEdit event in GridView
Feb 04, 2019 06:51 AM|oned_gk|LINK
Use DataKeyNames
Suwandi - Non Graduate Programmer
Participant
860 Points
498 Posts
Re: Cell value is always empty in RowCancelingEdit event in GridView
Feb 04, 2019 08:15 AM|AddWeb Solution|LINK
Please place below code in your grid cancel event :
GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];
TextBox id = (TextBox)row.Cells[1].Controls[0];
var data = id.Text;
Response.Write("You cancelled the edit operation for employee with id: " + data);
GridView1.EditIndex = -1;
BindGrid();