AlternatingItemStyle

2 posts, 0 answers
  1. Kjell
    Kjell avatar
    203 posts
    Member since:
    May 2011

    Posted 06 Nov Link to this post

    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?

     

     

  2. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 10 Nov Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top