how should this IF-statement be ?

  • Thread starter Thread starter Jeff
  • Start date Start date
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?
 
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)
 
Back
Top