Hello,
My Goal: To use the default AlternatingItemStyle. To evaluate each grid row, if that grid rows Order column = PreviousRow's Order column, then set the CurrentRows.BackColor = PreviousRows.Backcolor.
My Problem seems to be, that the BackColor doesn't exist in the RadGrid_ItemDataBound() event.
I don't want to set my own AlternatingItemStyle in a .CSS for this, because My Whole Site is managed via Telerik Skins, and if I want to chagne the skin, i don't want to have to change this AlternatingStyle to match.
How can I capture what the Color is?
My Code:
My Goal: To use the default AlternatingItemStyle. To evaluate each grid row, if that grid rows Order column = PreviousRow's Order column, then set the CurrentRows.BackColor = PreviousRows.Backcolor.
My Problem seems to be, that the BackColor doesn't exist in the RadGrid_ItemDataBound() event.
I don't want to set my own AlternatingItemStyle in a .CSS for this, because My Whole Site is managed via Telerik Skins, and if I want to chagne the skin, i don't want to have to change this AlternatingStyle to match.
How can I capture what the Color is?
My Code:
//Changing the backcolor so that rows w/ the same order number show the same color
if
(e.Item
is
GridDataItem && e.Item
is
GridTableRow)
{
int
rowNumber = e.Item.DataSetIndex;
if
(rowNumber >= 1)
{
GridDataItem previousRow = RadGrid1.Items[rowNumber - 1];
GridDataItem currentRow = (GridDataItem)e.Item;
string
prevMilestoneOrder = previousRow[
"Order"
].Text;
//Set current row back color to previous row back color if they have the same order
if
(prevMilestoneOrder.Equals(currentRow[
"Order"
].Text))
currentRow.BackColor = previousRow.BackColor;
//<------- previousRow.BackColor does not exist yet
}
}