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

Cannot get headertext to display for GridClientSelectColumn

5 Answers 221 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 01 Apr 2009, 08:26 PM
Hello All,

I was wondering if anyone could point out what I'm doing wrong while trying to get the headertext to display ofr a GridClientSelectColumn. It's working fine for the other GridTemplateColumns. Here's the code I'm using and I've tried several variations and I can't get it to work.

<telerik:GridClientSelectColumn Reorderable="False" UniqueName="ClientSelectColumn" HeaderText="Select All">
                        <HeaderStyle Width="130" HorizontalAlign="Left" Font-Size="10px"></HeaderStyle>
                    </telerik:GridClientSelectColumn>

I've also tried using the text property of the GridClientSelectColumn. I'm using the Mar 11, 2009 Q1 version of the Telerik.web.UI.dll

Any help would be greatly appreciated and thanks in advance!

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Apr 2009, 03:43 AM
Hello Paul,

A possible approach is to add a label to the control collection of the header item as shown below:
aspx:
<telerik:GridClientSelectColumn  UniqueName="column"></telerik:GridClientSelectColumn> 

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridHeaderItem) 
        { 
            GridHeaderItem header = (GridHeaderItem)e.Item; 
            Label lbl = new Label(); 
            lbl.Text = "Select All"
            header["column"].Controls.AddAt(1, lbl); 
        } 
    } 

Thanks
Princy.
0
Paul
Top achievements
Rank 1
answered on 02 Apr 2009, 10:58 PM
Thanks Princey! I'll give that a shot.
0
L
Top achievements
Rank 1
answered on 15 Mar 2012, 06:54 PM
Hi all,

I have a page with a hidden error message in the top, a grid in the middle an a button in the bottom.
I have used the suggestion explained here, but if I click the button and get an error, the error message is showing perfect but the header text for the GridClientSelectColumn disappears. 

Because the text is added in the OnItemDataBound, if I rebind the grid everything is perfect, but I I get an error I don't want to go and rebind the grid. Any suggestions?
0
Princy
Top achievements
Rank 2
answered on 16 Mar 2012, 08:45 AM
Hello,

This happens because you are binding the grid using simple data binding. You can achieve what you need with advanced data binding using its "NeedDataSource" event to bind the grid. Please follow up the help documentation and I am sure you will get this sorted.
Hope this helps.

Regards,
Princy.
0
Praneet
Top achievements
Rank 1
answered on 30 Dec 2013, 10:25 AM
Hi Princy !

The code on ItemDataBound worked for me to.

Thanks.
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Paul
Top achievements
Rank 1
L
Top achievements
Rank 1
Praneet
Top achievements
Rank 1
Share this question
or