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

Hiding checkbox in grid header causes all headers to shift left

2 Answers 201 Views
Grid
This is a migrated thread and some comments may be shown as answers.
apb
Top achievements
Rank 1
apb asked on 13 Sep 2010, 08:06 PM
It used to be that adding this to a page

<style type="text/css"
    .RadGrid_Windows7 .rgCheck 
    
        display: none !important
    
</style>

would hide the checkbox in the header of a grid with a GridClientSelectColumn.

Now, it causes the header of the column to disappear for that column and all the other headers to shift left. See attached.

This broke in the last release or two.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 14 Sep 2010, 07:17 AM
Hello,

I tried the same css and it worked for me. I guess the problem may be with the version that you are using. I am using RadControl  2010,1,519,35 version.

As an alternative you can  try accessing the checkbox from code behind and set the Visible property to false. Here is the sample code.
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
 {
     if (e.Item is GridHeaderItem)
     {
           GridHeaderItem hitem = (GridHeaderItem)e.Item;
           CheckBox chk= (CheckBox) hitem["chk"].Controls[0];
           chk.Visible = false;
     }
}

Where the aspx that I used is:
<Columns>
    <telerik:GridClientSelectColumn HeaderText="Chk" UniqueName="chk">
    </telerik:GridClientSelectColumn>


-Shinu.
0
apb
Top achievements
Rank 1
answered on 14 Sep 2010, 02:54 PM
Thanks, Shinu. That worked perfectly.
Tags
Grid
Asked by
apb
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
apb
Top achievements
Rank 1
Share this question
or