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

radgrid column values multi color change

3 Answers 145 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kingsleen
Top achievements
Rank 1
Kingsleen asked on 09 Mar 2011, 05:10 AM
Hi all,
           In radgrid i have a column called Employee names in this i will get the value as Employee1|Employee2|Employee3. I need the color change for the value Employee1 should be red color and Employee2 should be Green color and Employee3 should be Blue in color. Please Help me out.

Can you help me figure out what I have to do in radgrid?

Thank you,
Kingsleen Solomon Doss.J

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Mar 2011, 05:35 AM
Hello Kingsleen,

You can try the following code snippet to achieve the same.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
   if (e.Item is  GridDataItem)
   {
       GridDataItem item = (GridDataItem)e.Item;
       if (item["ColumnUniqueName"].Text == "Employee1")
       {
           item.BackColor = System.Drawing.Color.Red;
       }
   }
}

Thanks,
Shinu.
0
Kingsleen
Top achievements
Rank 1
answered on 09 Mar 2011, 05:41 AM
Thanks shinu but it is changing the full color of the coloumn value i need the alternate color in a single column.

Regards
Kingsleen Solomon Doss.J
0
Shinu
Top achievements
Rank 2
answered on 09 Mar 2011, 05:58 AM
Hello Kingsleen,

You can achieve this by setting the BackColor for the Table Cell. Checkout the following help article which describes the same.
Accessing cells and rows

Thanks,
Shinu.
Tags
Grid
Asked by
Kingsleen
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Kingsleen
Top achievements
Rank 1
Share this question
or