How to check for Edit mode of the GridView row irrespective of it is normal or alternate row

Posted by Raja under ASP.NET category on | Views : 12002
When you try to check for the Edit mode in the OnRowDataBound event of the GridView, you will face a problem when you try to edit the alternate row and checking for edit mode.

Like OnRowDataBound="BindDetailsForEditMode"

In the BindDetailsForEditMode event, you can check for following condition to ensure that you are into edit mode irrespective of normal row or alternate row you are editing.

if (e.Row.RowState == DataControlRowState.Edit || e.Row.RowState ==
(DataControlRowState.Edit | DataControlRowState.Alternate))
// write your statement that you want to fire in Edit mode


Comments or Responses

Login to post response