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

Set Grid Row Alternate Style

2 Answers 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Felix
Top achievements
Rank 1
Felix asked on 08 Jun 2015, 02:50 PM

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 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 11 Jun 2015, 08:41 AM
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
0
Felix
Top achievements
Rank 1
answered on 24 Jun 2015, 08:45 PM

Hi Eyup

Thank you very much for your help. Works perfectly!

Regards
Felix

Tags
Grid
Asked by
Felix
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Felix
Top achievements
Rank 1
Share this question
or