I'm trying to add a CssClass to a row in my grid. I use an OnItemDataBound method to do this, with the following code:
| protected void uxGrid_OnItemDataBound(Object sender, GridItemEventArgs e) | |
| { | |
| if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) | |
| { | |
| e.Item.CssClass += " foo"; | |
| } | |
| } |
However, I'm finding that this code REPLACES the class attribute on the row rather than appending to it.
Without the OnItemDataBound event, the generated HTML is:
| <tr class="rgRow" id="..."> |
With the event, I'd expect this:
| <tr class="rgRow foo" id="..."> |
But instead I get this:
| <tr class=" foo" id="..."> |
Note that no classes are added in any settings on my aspx page. (Also note that I've removed other logic from the OnItemDataBound event for clarity - in reality I only want to add the "foo" class when certain conditions are met.)
What am I doing wrong?
Many thanks!
Jake
