[英]Client Side validation in Telerik's MVC Grid
Is it possible to add client side validation to the fields of the Telerik MVC Grid at runtime. 是否可以在运行时将客户端验证添加到Telerik MVC网格的字段中。 I am having validation JSON strings stored in the DB which I need to use when inserting or updating content
我在数据库中存储了验证JSON字符串,在插入或更新内容时需要使用该字符串
Thanks for the clarification in the comments. 感谢您在评论中的澄清。
By default validation rules are set using data annotation attributes. 默认情况下,验证规则是使用数据注释属性设置的。 However I think you can implement custom metadata provider for ASP.NET MVC that applies validation rules at runtime.
但是我认为您可以为ASP.NET MVC实现自定义元数据提供程序,该程序在运行时应用验证规则。 Perhaps this and this blog posts will be of help.
也许这和这个博客帖子会有所帮助。
A more hacky solution would be to generate the JSON for the rules and override the ones output by ASP.NET MVC. 一个更具技巧性的解决方案是为规则生成JSON,并覆盖ASP.NET MVC输出的规则。 Check the output of a page with client-side validation enabled and look for
mvcClientValidationMetadata
. 检查启用了客户端验证的页面的输出,并查找
mvcClientValidationMetadata
。
I hope this helps 我希望这有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.