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

Show text depending the value of cell

2 Answers 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tajes
Top achievements
Rank 1
Tajes asked on 17 Feb 2011, 02:59 PM
Hello,
   I want show a text in a column bound to a bool field, showing diferent text depending if the value is true or false. And also in a column bound to a int field, showing diferent text devending the value.

Can anyone help me?
thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 18 Feb 2011, 06:28 AM
Hello Tajes,

Here is a sample code 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["ColUniqueName"].Text == "True")
         {
             TableCell cell = item["ColUniqueName"];
             cell.Text = "NewText";
         }
     }
}

Thanks,
Shinu.
0
Tajes
Top achievements
Rank 1
answered on 18 Feb 2011, 10:01 AM
Thank you so much Shinu. It works perfectly.
Tags
Grid
Asked by
Tajes
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Tajes
Top achievements
Rank 1
Share this question
or