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

Set Color to Cells in RadGrid

2 Answers 537 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gerry Polami
Top achievements
Rank 1
Gerry Polami asked on 26 Jun 2011, 08:31 AM
Hello
I have a simple radgrid (not in edit mode)  that i want to set some of his cells color, according to the value of the firs column of each row.
What i mean is to loop each row in the grid ,check the value of the first column of this gridraw and then set the colors of the rest of the cell in this gridraw according to this value.
How should i do it ?
Thanks,
Gerry

2 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 27 Jun 2011, 06:17 AM
HI,

protected void grdMapping_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem dataItem = (GridDataItem)e.Item;
        if(dataItem["ColumnUniqueName1"].Text == "YourComparisionText")
        {
            dataItem["ColumnUniqueName"].Style["color"] = "orange";
        }
    }
}


Thanks,
Jayesh Goyani
0
Gerry Polami
Top achievements
Rank 1
answered on 27 Jun 2011, 07:48 AM
Thanks Jeysh  :)
Tags
Grid
Asked by
Gerry Polami
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Gerry Polami
Top achievements
Rank 1
Share this question
or