how should this IF-statement be ?

J

Jeff

hi

asp.net 2.0

I have an if statment in my code which test if row state is in Edit mode
if (e.Row.RowState == DataControlRowState.Edit)
{
}

But now I've learned that that code will not be executed when the row also
have Alternate state.
So how should the if statment above be if I should include Alternate state
too?

I've tryed this, but it doesn't seem to work
if ((e.Row.RowState == DataControlRowState.Edit) || ((e.Row.RowState ==
DataControlRowState.Edit) && (e.Row.RowState ==
DataControlRowState.Alternate)))

any suggestions?
 
B

bruce barker

the rowstate is a bit array stored as an int. use the bit operators to test:

if (e.Row.RowState & DataControlRowState.Edit != 0)
// some code



-- bruce (sqlwork.com)
 

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,774
Messages
2,569,596
Members
45,127
Latest member
CyberDefense
Top