This is a migrated thread and some comments may be shown as answers.

Nested Control Validation

1 Answer 53 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Neil
Top achievements
Rank 1
Neil asked on 18 Nov 2010, 07:30 PM

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?

Thanks,
Neil

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 23 Nov 2010, 06:07 PM
Hello Neil,

The validators should validate controls on the same form but not a control placed in a UserControl , because the UserControl could contain multiple other controls and html elements and the validator will be unable to validate all of them when setting its ControlToValidate value to the name of the user control.

That is why our suggestion is to not use this approach or put the validators directly inside the usercontrol's ascx file.


Greetings,
Rumen
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Editor
Asked by
Neil
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or