【问题标题】:Validation Message is shown even there is no error message即使没有错误消息也会显示验证消息
【发布时间】:2021-06-29 04:44:05
【问题描述】:

我已经创建了一个表单以及其他具有验证的字段,并且有一个字段没有validationMessageFor,但在validationSummary 中我能够看到该字段的错误并且模型没有所需的属性。

【问题讨论】:

  • 请发布您的模型和视图以获得任何响应
  • 下面是模型 public int a_initID{ get;放; } 公共字符串 a_inty{ 得到;放; } 公共字符串 a_iniNat{get;set;} 公共搅拌 a_initName {get;set;}
  • @NagibMahfuz using (Html.BeginForm("WorkFlow", "Work", FormMethod.Post, new { class = "form-horizontal", autocomplete = "off", id = "frmCr" })) { Html.AntiForgeryToken() Html.ValidationSummary() Html.TextBoxFor(x => x.a_initID, new { @class = "form-control" })
  • @NagibMahfuz 你得到什么了吗。

标签: asp.net-mvc validationsummary


【解决方案1】:

Validation summary 应该显示模型上的所有错误消息,而与 UI 中的validationMessageFor 用法无关。 该字段可能包含与之关联的任何其他验证。请在此处发布您的模型。

【讨论】:

  • 下面是模型 public int a_initID{ get;放; } 公共字符串 a_inty{ 得到;放; } 公共字符串 a_iniNat{get;set;} 公共搅拌 a_initName {get;set;}
  • using (Html.BeginForm("WorkFlow", "Work", FormMethod.Post, new { class = "form-horizontal", autocomplete = "off", id = "frmCr" })) { Html.AntiForgeryToken() Html.ValidationSummary() Html.TextBoxFor(x => x.a_initID, new { @class = "form-control" })
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-12
  • 2018-02-25
相关资源
最近更新 更多