Alternating Selected Row

Nov 12, 2007 at 10:28 PM
Edited Nov 12, 2007 at 10:35 PM
Hey, I found a topic on this a while back at:
http://forums.asp.net/p/1026397/1399505.aspx

However, as of the latest source code #7464, I found it to still be an issue. Basically, the Adapter is neglecting to handle the cases in which an Alternating DataRow is both Alternating AND Selected ("Alternating, Selected"). To rectify this, I added the following code to the GridViewAdapter.cs:

case DataControlRowState.Selected | DataControlRowState.Alternate:
case DataControlRowState.Selected | DataControlRowState.Normal:
               className = " AspNet-GridView-Selected ";
		break;

where it had previously just accounted for DataControlRowState.Selected. I didn't see this issue being discussed, but if it has please accept my apologies in advance for a double post.
Coordinator
Nov 15, 2007 at 2:24 PM
Good point. I'm making the fixes on GridView now to better handle Selected and Edit states.

Changeset 7742 should have this fix.
Jan 11, 2008 at 5:17 PM
I have a GridView inside an UpdatePanel on a Page. Clicking anywhere on a Row causes a ModalPopupExtender to show up. Once it is dismissed, I am back to my GridView.

The row clicking is facilitated by emulating GridView's Select method which causes a row to become Selected.

The problem is that I am using Alternate and Normal Rows. If I have clicked on a Normal Row, when the popup is dismissed, everything is ok. If I clicked on an Alternate Row, it gets styled as Normal Row.

In other words, GridViewAdapter supports:
AspNet-GridView-Normal
AspNet-GridView-Alternate
AspNet-GridView-Selected

AspNet-GridView-Selected is both a Normal-Selected and a Alternate-Selected. In my case this was a problem. I have added a new CSS class AspNet-GridView-Alternate-Selected and modified GridViewAdapter.cs accordingly:

case DataControlRowState.Selected | DataControlRowState.Normal:
className = " AspNet-GridView-Selected ";
break;
case DataControlRowState.Selected | DataControlRowState.Alternate:
className = " AspNet-GridView-Alternate-Selected ";
break;