Search code examples
validationnestedradeditor

Nested Control Validation


I have a Telerik RAD Editor in a user control, so I can set defaults in one place to enable me to reuse the control where ever I need a rich text editor. When I add it to a page I want to validate the content property of the editor by using a RequiredFieldValidator control to ensure that the editor has content.

When I load the page, I get "Control 'radEditor' referenced by the ControlToValidate property of 'ValidateEditor' cannot be validated."

After some research, I discovered decorating the class with [System.Web.UI.ValidationProperty("RadEditor")] will expose the validation property in the markup page, but when I add this attribute, the page doesn't throw the above error, but it is not respecting the RequiredFieldValidator hooked up to the control when I submit the page without content.

Any ideas?


Solution

  • I suggest using a custom validator. You can create both client- and server-side functions to check for content.