I have a Control created which contains a Panel with a RadGrid (DataGrid) and a RadButton (myButton). When I click on the Button, the RadGrid will be disabled or enabled:
myButton.Click += (sender, args) => {
if (!this.DataGrid.Enabled) {
this.DataGrid.Enabled = true;
this.DataGrid.ClientSettings.EnablePostBackOnRowClick = true;
this.DataGrid.ClientSettings.Resizing.AllowColumnResize = true;
this.DataGrid.ClientSettings.Selecting.AllowRowSelect = true;
this.DataGrid.ClientSettings.AllowKeyboardNavigation = true;
} else {
this.DataGrid.Enabled = false;
this.DataGrid.ClientSettings.EnablePostBackOnRowClick = false;
this.DataGrid.ClientSettings.Resizing.AllowColumnResize = false;
this.DataGrid.ClientSettings.Selecting.AllowRowSelect = false;
this.DataGrid.ClientSettings.AllowKeyboardNavigation = false;
}
this.DataGrid.Rebind();
}
Disabling is working fine. But when I click a second time, I will get an Exception:
[GridException: Please set ClientSettings.Selecting.AllowRowSelect to "True" to start using GridClientSelectColumn.]
The RadGrid contains a GridClientSelectColumn.
Can anyone please help me, what I can do to prevent this exception? - The exception is occuring before the EventHandler of the myButton will called on the second click.
When I remove the GridClientSelectColumn it is working without Exception.