I have a custom server control which wraps a RadEditor (basically a textarea). I am trying to add a CustomValidator to it dynamically, but I keep getting this error on initial pageload
Unable to find control id 'RadEditor1' referenced by the 'ControlToValidate' property of ''.
This is the code I'm using inside my server control to create the CustomValidator:
protected override void OnInit(EventArgs e)
{
var validator = new CustomValidator();
validator.CssClass = "validator-error";
validator.Display = ValidatorDisplay.Dynamic;
validator.ControlToValidate = this.ID;
validator.Text = "You've exceeded the maximum allowed length for this field";
validator.ClientValidationFunction = "checkLength";
this.Controls.Add(validator);
base.OnInit(e);
}