Suhaib Ahmad
Suhaib Ahmad

Reputation: 526

How to get the RadCheckBox element in a RadGridView and toggle the checkbox

I have a RadGridView that has its first column(named "Visible") as a CheckBox cell in every row.

I have another CheckBox that toggles all the CheckBoxes in the GridView. In this CheckBox's ToggleStateChanged handler, I am trying to get the checkbox element in the GridView row and toggle its state.

Note that the CheckBox to toggle all GridView checkboxes is outside the GridView. I.e. I have a GroupBox that contains the GridView, and it contains the CheckBox. The CheckBox in the GroupBox should toggle all the CheckBoxes in the GridView.

This is what I'm trying at the moment(among other things that I cannot currently remember):

foreach(var myGridRow in curveGridView.Rows)
{
    ((GridViewCheckBoxColumn)myGridRow.Cells["Visible"].ColumnInfo).Checked = Telerik.WinControls.Enumerations.ToggleState.On;
}

But I am unable to get the CheckBox element and I cannot toggle its state.

Any and all suggestions on how to implement this would be greatly appreciated. Thanks

Upvotes: 0

Views: 31

Answers (0)

Related Questions