Set Grid Row Alternate Style

3 posts, 0 answers
  1. Felix
    Felix avatar
    6 posts
    Member since:
    Sep 2014

    Posted 08 Jun 2015 Link to this post

    Hi

     Is it possible to define, which rows of a grid shall get the alternate style depending on a database value instead of alternate every second row?

     Kind regards

  2. Eyup
    Admin
    Eyup avatar
    3841 posts

    Posted 11 Jun 2015 Link to this post

    Hi Felix,

    You can achieve this requirement using the following approach:

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = e.Item as GridDataItem;
            item.CssClass = item.ItemIndex % 3 == 0 ? "rgAltRow" : "rgRow";
        }
    }

    Hope this helps. Please give it a try and let me know if it works for you.

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Felix
    Felix avatar
    6 posts
    Member since:
    Sep 2014

    Posted 24 Jun 2015 in reply to Eyup Link to this post

    Hi Eyup

    Thank you very much for your help. Works perfectly!

    Regards
    Felix

Back to Top