Find Mode in GridView RowDataBound

  • Thread starter Thread starter David C
  • Start date Start date
D

David C

My brain is fried. How can I determine if the row is in edit mode when
processing the RowDataBound event? Thanks.

David
 
My brain is fried. How can I determine if the row is in edit mode when
processing the RowDataBound event? Thanks.

David

Try checking the EditIndex property on your GridView.

protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (this.GridView1.EditIndex == -1)
{
//not in edit mode...
}
else
{
//in edit mode
}
}
 
My brain is fried. How can I determine if the row is in edit mode when
processing the RowDataBound event? Thanks.

David

if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowState ==
DataControlRowState.Edit)
{
...
}

Regards
Mykola
http://marss.co.ua
 
Thank you both. I'll keep this somewhere so I can refer to it the next time
my brain goes dead.

David
 
Back
Top