我正在开发一个 asp.net MVC3 应用程序,我正在使用不显眼的验证。因为我有一条错误消息,我想在两行中显示,我将错误消息定义为:
[Required(ErrorMessage = "Your password must be at least 6 characters long. <br/> Please try again.")]
我想在验证消息中编码中断标记,并希望在两行中显示消息。我尝试过以下事情:
1.)
@{
string s = Html.ValidationMessageFor(model => model.Password).ToString();
}
@Html.Raw(HttpUtility.HtmlDecode(s))
2.)
@Html.Raw(Server.HtmlDecode(Html.ValidationMessageFor(m => m.Password).ToString()))
3.)
[Required(ErrorMessage = "Your password must be at least 6 characters long. //n Please try again.")]
以上都不起作用。
有人可以帮忙吗??
任何帮助,将不胜感激 ...