This is a migrated thread and some comments may be shown as answers.

AlternatingItemStyle

1 Answer 364 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Iron
Kjell asked on 06 Nov 2016, 01:20 PM

I use Skin Bootstrap and RenderMode Lightweight

Bootstrap use AlternatingItemStyle gray. I dont want to use that, i want have White for all items

I try set <AlternatingItemStyle BackColor="#ffffff" /> Not works....

<ItemStyle BackColor="#ffffff" /> works fine....

BackColor="#ffffff" Not works....

 

How to use White for all items in grid?

 

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 10 Nov 2016, 06:44 AM
Hello Kjell,

Yes, this inconsistency is probably only for the Bootstrap skin. Generally, you can achieve this requirement using CSS by applying the background color to the individual cells:
http://www.telerik.com/forums/preserving-the-style-of-the-radgrid-row-on-applying-custom-cssstyle#VQkeeJv1T0GPos9vmwbFXg


Alternatively, this approach should also work:
Copy Code
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = (GridDataItem)e.Item;
        if (item.ItemIndex % 3 == 0) // custom condition
        {
            foreach (TableCell cell in item.Cells)
            {
                cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#b64949");
            }
        }
    }
}

But for bootstrap skin, instead of using dataItem.BackColor, set the color to the cells individually:
            foreach (TableCell cell in item.Cells)
            {
                cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#b64949");
            }

I hope this will prove helpful.


Regards,
Eyup
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Tags
Grid
Asked by
Kjell
Top achievements
Rank 1
Iron
Answers by
Eyup
Telerik team
Share this question
or