嵌套控件验证
我的用户控件中有一个 Telerik RAD 编辑器,因此我可以在一处设置默认值,以便在需要富文本编辑器时能够重用该控件。当我将其添加到页面时,我想通过使用RequiredFieldValidator 控件来验证编辑器的内容属性,以确保编辑器具有内容。
当我加载页面时,我得到“Control 引用的“radEditor” ControlToValidate 属性 无法验证“ValidateEditor”。”
经过一番研究,我发现用 [System.Web.UI.ValidationProperty("RadEditor")] 装饰类会在标记页面中公开验证属性,但是当我添加此属性时, 它不尊重连接到控件的RequiredFieldValidator。
页面不会抛出上述错误,但当我提交没有内容的页面时,
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议使用自定义验证器。您可以创建客户端和服务器端函数来检查内容。
I suggest using a custom validator. You can create both client- and server-side functions to check for content.