I add column checkbox in radGridView. When I check it error " Specified cast is not valid "
Code:
if (this.radGridView1.ActiveEditor is RadCheckBoxEditor)
{
bool value = (bool)this.radGridView1.ActiveEditor.Value;
}
Help Me. Thank You.
1 Answer, 1 is accepted
0
Accepted
Svett
Telerik team
answered on 19 Jul 2010, 08:10 PM
Hi kenny,
The exception is thrown because you have tried to cast the RadCheckBoxEditor's value to a bool type. The editor value is from type ToggleState, because of its tree state feature. Hence, you need to cast it to ToggleState type:
Telerik.WinControls.Enumerations.ToggleState state = (Telerik.WinControls.Enumerations.ToggleState)checkBox.Value;
boolisTrue = state == Telerik.WinControls.Enumerations.ToggleState.On;
}
Sincerely yours,
Svett
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items