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

[Solved] GridClientSelectColumn header checkbox resets

1 Answer 129 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Graham King
Top achievements
Rank 1
Graham King asked on 23 Apr 2008, 08:46 AM
Hi,

I'm trying to set the checkbox.checked for the checkbox in the header of the GridClientSelectColumn when AllowMultiRowSelection="true".

I'm using the following code:
foreach (GridHeaderItem HeaderItem in costCentresGrid.MasterTableView.GetItems(GridItemType.Header)) 
        { 
            //Find the SelectAll CheckBox in the header using the ClientSelectColumn's  "UniqueName"   
            CheckBox chkSelectAll = (CheckBox)HeaderItem["CostCentreSelectColumn"].Controls[0]; 
            chkSelectAll.Checked = costCentresGrid.MasterTableView.Items.Count == costCentresGrid.SelectedItems.Count; 
        } 

The problem I'm having is that even before line 5 runs, the chkSelectAll.Checked is correctly set.  No matter what I set it to though the checkbox always clears when the ajax call (in which the above code runs) is ALWAYS set to false.

How can I keep the checkbox checked even when it is set to checked?

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 29 Apr 2008, 07:40 AM
Hi Graham,

Indeed, this behavior will be present since the behavior of the controls in the select columns of RadGrid is controlled via Js. Because of this, I would suggest that you employ a standard template column, with nested checkboxes, to allow for any custom logic that you may have.
I hope this is a suitable approach for you.

Greetings,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Graham King
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or