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

highlight / change appearance of one grid item

3 Answers 34 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mario
Top achievements
Rank 2
Mario asked on 07 Sep 2009, 12:37 PM
Hi,

i got a grid in which one item is more important than the others.

How can i change its appearance or highlight it?

Im currently there but i dont know what to do..

protected void RadGridHistory_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridDataItem) 
            { 
                GridDataItem item = (GridDataItem)e.Item; 
 
                string key = item.KeyValues; 
                int id = ParseIdFromKeyValueString(key); 
 
                if (id == Convert.ToInt32(Request["id"].ToString())) 
                { 
                    // change appearance. like bold text of the GridBoundColumns
                } 
            } 
        } 

thx Mario

3 Answers, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 07 Sep 2009, 12:56 PM
Hi Mario,

To achieve the desired functionality I suggest you examine the following help topic:
Conditional Formatting for rows/cells on ItemDataBound

Kind regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 07 Sep 2009, 01:01 PM
Hi Mario,

Try the following code in order to change the appearance of cell value based on condition.

C#:
 
protected void RadGridHistory_ItemDataBound(object sender, GridItemEventArgs e)   
{   
    if (e.Item is GridDataItem)   
    {   
        GridDataItem item = (GridDataItem)e.Item;   
        string key = item.KeyValues;   
        int id = ParseIdFromKeyValueString(key);   
        if (id == Convert.ToInt32(Request["id"].ToString()))   
        {   
            // change appearance. like bold text of the GridBoundColumns  
               item["CustomerID"].ForeColor = System.Drawing.Color.Red;  // Where CustomerID is the ColumnUniqueName 
               item["CustomerID"].Style.Add("font-weight""bold");              
        }   
    }   
}   

-Shinu.
0
Mario
Top achievements
Rank 2
answered on 07 Sep 2009, 01:22 PM
thx Shinu, guess that was an easier one :p
Tags
Grid
Asked by
Mario
Top achievements
Rank 2
Answers by
Pavlina
Telerik team
Shinu
Top achievements
Rank 2
Mario
Top achievements
Rank 2
Share this question
or