M
Mantorok
Hi all
I finally got around to creating some WebControl classes, however I want to
add some validation to my custom control, it's a descendant of
CompositeControl.
I get the exception: Unable to find control id 'txtForename' referenced by
the 'ControlToValidate' property of 'valType'
Here is how I'm creating the validtor(s):
protected override void CreateChildControls()
{
// Create the custom validator
CustomValidator customVal = new CustomValidator();
customVal.ID = ID_CUSTOMVAL;
customVal.ServerValidate += new
ServerValidateEventHandler(validator_ServerValidate);
customVal.Text = TEXT_VALIDATOR;
Controls.Add(customVal);
// Create the compare validator
CompareValidator typeVal = new CompareValidator();
typeVal.ID = ID_TYPEVAL;
typeVal.Operator = ValidationCompareOperator.DataTypeCheck;
typeVal.Text = TEXT_VALIDATOR;
typeVal.ControlToValidate = ID;
Controls.Add(typeVal);
base.CreateChildControls();
}
Any ideas?
Thanks
Kev
I finally got around to creating some WebControl classes, however I want to
add some validation to my custom control, it's a descendant of
CompositeControl.
I get the exception: Unable to find control id 'txtForename' referenced by
the 'ControlToValidate' property of 'valType'
Here is how I'm creating the validtor(s):
protected override void CreateChildControls()
{
// Create the custom validator
CustomValidator customVal = new CustomValidator();
customVal.ID = ID_CUSTOMVAL;
customVal.ServerValidate += new
ServerValidateEventHandler(validator_ServerValidate);
customVal.Text = TEXT_VALIDATOR;
Controls.Add(customVal);
// Create the compare validator
CompareValidator typeVal = new CompareValidator();
typeVal.ID = ID_TYPEVAL;
typeVal.Operator = ValidationCompareOperator.DataTypeCheck;
typeVal.Text = TEXT_VALIDATOR;
typeVal.ControlToValidate = ID;
Controls.Add(typeVal);
base.CreateChildControls();
}
Any ideas?
Thanks
Kev