Wednesday, March 28, 2012

The bitwise combination of the DataControlRowState values

Hi,

I want to use the switch loop for the state of a gridrow:

switch (gvr.RowState)
{
case DataControlRowState.Selected:
case DataControlRowState.Alternate:
case DataControlRowState.Normal:
// doing something
break;
case DataControlRowState.Edit:
// doing something
break;
case DataControlRowState.Insert:
// doing something
break;
}

But because the row can be both selected and normal (bitwise combination), the rowstate is none of them. when I output the rowstate to the page it is for example "Selected, Normal". How can I add a case value for a bitwise combination?

KaaNThis will work:

case DataControlRowState.Selected | DataControlRowState.Normal:

0 comments:

Post a Comment