Hello.
In my application, depending on the specific data in the grid I may want to warn a user who clicks on the header checkbox that changing all the values in that column may not be what he intends, allowing him to cancel out of the operation. I haven't found a handler that gets called when clicking on the header checkbox that allows me to cancel the event. How can I accomplish this?
Hello Michael,
RadGridView offers the HeaderCellToggleStateChanged event that fires when the RadCheckedBoxElement in the header cell has already been changed. However, it seems to be a reasonable request to allow users to prevent the operation under some circumstances.
This is why I have logged it as a feature request on our Feedback portal by making this thread public. You can vote for it, subscribe to status changes, and add your comment to it here. The more votes an item gathers, the higher its priority becomes.
I have also updated your Telerik Points.
Currently, the possible solution that I can suggest is to access the checkbox within the GridCheckBoxHeaderCellElement and handle its ToggleStateChanging that can be canceled:
private void RadGridView1_CellClick(object sender, GridViewCellEventArgs e)
{
if (sender is GridCheckBoxHeaderCellElement)
{
GridCheckBoxHeaderCellElement cell = sender as GridCheckBoxHeaderCellElement;
cell.CheckBox.ToggleStateChanging -= this.CheckBox_ToggleStateChanging;
cell.CheckBox.ToggleStateChanging += this.CheckBox_ToggleStateChanging;
}
}
private void CheckBox_ToggleStateChanging(object sender, StateChangingEventArgs args)
{
args.Cancel = true;
}
I hope this helps. Should you have other questions do not hesitate to ask.
Regards,
Nadya
Progress Telerik