如何更改模型状态消息 [英] How to change the Model state Message

查看:91
本文介绍了如何更改模型状态消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友



我想更改模型雕像消息,例如



Hi Friends

I Want to change the Model statue message like

The value ''adg'' is not valid for CagrRate1.





我添加了Globel资源文件

并在globel文件中添加行



这是





I have added the Globel resource file
and add the line in globel file

which is

protected void Application_Start()
       {
           AreaRegistration.RegisterAllAreas();
          DefaultModelBinder.ResourceClassKey = "ModelErrorMessages";//this is for the customize error messages
           RegisterGlobalFilters(GlobalFilters.Filters);
           RegisterRoutes(RouteTable.Routes);
       }





但如何为模特的个人财产做这件事



请帮助我



谢谢



but how to do this for the individual property of model

Please Help me

Thanks

推荐答案

我实际上发现这个非常有用的帖子来自 Prasad_Kulkarni



你可以在这里找到:如何使用C#语言在asp.net中显示消息? [ ^ ]



对Prasad_Kulkarni的称赞
I actually found this very useful post from Prasad_Kulkarni

You can find it here: how to display messages in asp.net using C# language?[^]

Kudos to Prasad_Kulkarni


这篇关于如何更改模型状态消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆