Find Mode in GridView RowDataBound

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
 
D

Dan Gartner

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
}
}
 
M

marss

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
 
D

David C

Thank you both. I'll keep this somewhere so I can refer to it the next time
my brain goes dead.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top