This is the error I get on my custom validator. If I change the validator to a different control to validate - like a textboxcontrol - then it works fine. But it won't work for my checkbox.
<telerik:GridCheckBoxColumn HeaderText="Primary" DataType="System.Boolean" DataField="IsPrimary" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None" UniqueName="PhoneIsPrimary">
<HeaderStyle Width="10px" />
</telerik:GridCheckBoxColumn>
protected void RadGrid1_ItemCreated1(object sender, GridItemEventArgs e)
{
if (e.Item.OwnerTableView.Name == "Phone")
{ if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem item2a = e.Item as GridEditableItem;
GridCheckBoxColumnEditor editor2a = (GridCheckBoxColumnEditor)item2a.EditManager.GetColumnEditor("PhoneIsPrimary");
TableCell cell2a = (TableCell)editor2a.CheckBoxControl.Parent;
CustomValidator validator2a = new CustomValidator();
editor2a.CheckBoxControl.ID =
"ValidatePhoneIsPrimary";
validator2a.ControlToValidate = editor2a.CheckBoxControl.ID;
validator2a.ErrorMessage =
"Inactive or Closed Phone can not be Primary Phone";
validator2a.ServerValidate +=
new ServerValidateEventHandler(CustomValidator1_ServerValidate);
cell2a.Controls.Add(validator2a);
}}}
protected void CustomValidator1_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
{
if (args.Value == "0"){args.IsValid = true;}}
If I can get this working I will also need to look at and compare args.value to my combobox dropdown selected value - I am not sure how to retrieve that value here in my validation routine.