I do not want to use AltRowCssClass style. But I want to set row color accroding to different data value.
I find AltRowCssClass style overrider CssClass style. Following is my code:
protected void WebDataGrid_PreRender(object sender, EventArgs e)
{
WebDataGrid grid = sender as WebDataGrid;
for (int i = 0; i < grid.Rows.Count; i++)
if (grid.Rows[i].Items.FindItemByKey("CHECKED_FLAG").Text == "False")
grid.Rows[i].Items.FindItemByKey("DESCRIPTION").CssClass = "igg_RedRow";
else
grid.Rows[i].Items.FindItemByKey("DESCRIPTION").CssClass = "igg_WhiteRow";
}
Hello foxbabby ,
Thank you for posting in our forum.
You have a few options here:
1) For your custom styles set to the settings that get overridden the !important tag. For example if the style is:
. igg_RedRow
background-color: red;
Modify it like this:
background-color:red !important;
And that style will overwrite the default one.
2) Find the AltRow style in the style folder you’re using –ig_res/YourStyle and remove it.
Let me know if you have any questions or concerns.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://ko.infragistics.com/support
I just want to remove AltRow style in one web page。So I can not remove it from ig_res/。。。
The first method have some bug : If I changed AltRow style through this method ,I find all the even row has changed. I just want to set row style dynamic. Row style may be different with each other.
Hello,
The normal rows also have a default style set to them. So it will overwrite your igg_WhiteRow style if you don’t set it with the !important tag as well.
Please refer to the attached sample where there are 2 classes:
.Red
background-color:Red !important;
.Blue
background-color:Blue !important;
For even rows to the first item the Red style is applied and to the odd ones the Blue style is applied.
Note that when you set the important tag your custom classes will take precedent over the default ones.
Let me know If you have any questions.