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

Adding Text to GridClientSelectColumn

2 Answers 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 1
Don asked on 18 Mar 2010, 04:57 PM
How do I add text to the generated text boxes for this column. The check boxes show up fine and work as expected, I just want text next to them. This includes the header. I set the header text property but that doesn't seem to do anything.

Here is the definition for the column.

                        <telerik:GridClientSelectColumn DataTextField="Id" HeaderText="Select All"  
                            HeaderAbbr="Select All" HeaderButtonType="TextButton"  
                            HeaderTooltip="Select/Deselect All" Text="Select" /> 
 

Don

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 1
answered on 19 Mar 2010, 06:48 AM

Hello Don,

I achieved same functionality by using the code snippet.

C#:

 
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)  
    {  
        if (e.Item is GridHeaderItem)   
        {  
            GridHeaderItem headerItem = (GridHeaderItem)e.Item;  
            LiteralControl lControl = new LiteralControl();  
            lControl.Text = "Header";  
            headerItem["SelectMe"].Controls.Add(lControl); // Add text to Header  
        }  
        if (e.Item is GridDataItem)  
        {  
            GridDataItem item = (GridDataItem)e.Item;  
            LiteralControl lControl = new LiteralControl();  
            lControl.Text = "Select";  
            item["SelectMe"].Controls.Add(lControl); // Add text to each item  
        }  
    } 

And here is the ASPX:

 
<telerik:GridClientSelectColumn DataTextField="Id" HeaderText="Select All" HeaderAbbr="Select All"  
    HeaderButtonType="LinkButton" HeaderTooltip="Select/Deselect All" Text="Select"  
    UniqueName="SelectMe">  
</telerik:GridClientSelectColumn> 

-Shinu.

0
Don
Top achievements
Rank 1
answered on 19 Mar 2010, 02:30 PM
Thanks, that works like a charm.

Don
Tags
Grid
Asked by
Don
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Don
Top achievements
Rank 1
Share this question
or