在站点范围内更改所需验证消息的最简单方法(Easiest way to alter required validation message site wide)

编程入门 行业动态 更新时间:2024-10-22 11:02:26
在站点范围内更改所需验证消息的最简单方法(Easiest way to alter required validation message site wide)

我想替换所有具有[Required]属性的模型属性的验证消息,默认为“XY字段是必需的”。 至 ”*”。 我想在一个地方做那个站点,而不必向Required attributes添加自定义消息或将其他参数传递给ValidationMessageFor()Html帮助器。

有任何想法吗?

I would like to replace validation message for all model properties that have [Required] attribute from the default "The XY field is required." to "*". I want to do that site wide in one place without having to add a custom message to Required attributes or passing additional parameter to ValidationMessageFor() Html helper.

Any ideas?

最满意答案

在这里查看我的问题的答案:

在ASP.NET MVC 2中本地化错误消息(默认验证属性)

See the answer to my question here :

Localizing Error Messages In ASP.NET MVC 2 (Default Validation Attributes)

更多推荐

Required,XY,ValidationMessageFor,消息,电脑培训,计算机培训,IT培训"/> <meta name

本文发布于:2023-08-07 04:15:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1461236.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:范围内   所需   最简单   消息   站点

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!