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

[Solved] Very Simple RadGrid Question

1 Answer 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brett
Top achievements
Rank 1
Brett asked on 11 Sep 2009, 07:53 PM
I have a query that I am using for the RadGrid and one of the columns is a bit value.  The bit value displays a check box; checked for true and unchecked for false.  Is there any way I can change from this text box to a yes/no or true/false display?  Thanks!

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Sep 2009, 04:44 AM
Hi Brett,

Try the following approach and see whether it helps.

CS:
 
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            CheckBox chkbx=(CheckBox)item["columnUniqueName"].Controls[0]; 
            Literal literal = new Literal(); 
            literal.ID = "Literal1"
            if (chkbx.Checked) 
                literal.Text = "Yes"
            else 
                literal.Text = "No"
            item["columnUniqueName"].Controls.Clear(); 
            item["columnUniqueName"].Controls.Add(literal); 
        } 
    } 


Regards
Princy
Tags
Grid
Asked by
Brett
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or