验证渲染问题
我的模型中有这些数据注释:
[Required(ErrorMessage = "Adres is een verplicht veld")]
[MaxLength(250)]
public string D_Address { get; set; }
[Required(ErrorMessage = "Huisnummer is verplicht")]
public int D_AddressNumber { get; set; }
public string D_AddressExtra { get; set; }
[Required]
public int CapacityRate { get; set; }
[Required(ErrorMessage = "Postcode is een verplicht veld")]
[MaxLength(35)]
public string D_Zipcode { get; set; }
[Required(ErrorMessage = "Plaats is een verpicht veld")]
[MaxLength(250)]
public string D_City { get; set; }
在我的cshtml中:
@using (Html.BeginForm())
{
@Html.TextBoxFor(m => m.D_Address, new { @class = "span6" })
@Html.TextBoxFor(m => m.D_AddressNumber, new { @class = "span2" })
@Html.TextBoxFor(m => m.D_AddressExtra, new { @class = "span2" })
<br />
@Html.ValidationMessageFor(m => m.D_Address, null, new { @class = "label label-important" })
@Html.ValidationMessageFor(m => m.D_AddressNumber, null, new { @class = "label label-important" })
<br />
@Html.TextBoxFor(m => m.D_Zipcode, new { @class = "span4" })
@Html.ValidationMessageFor(m => m.D_Zipcode, null, new { @class = "label label-important" })
<br />
@Html.TextBoxFor(m => m.D_City, new { @class = "span4" })
@Html.ValidationMessageFor(m => m.D_City, null, new { @class = "label label-important" })
<br />
<input id="Submit1" type="submit" value="Versturen" class="btn btn-primary" />
<br />
@Html.ValidationSummary();
}
在我的本地机器上,它呈现如下:
<form action="/validatie/quoterequest" method="post">
<input class="span6" data-val="true" data-val-required="Adres is een verplicht veld" id="D_Address" name="D_Address" type="text" value="" />
<input class="span2" data-val="true" data-val-number="The field D_AddressNumber must be a number." data-val-required="Huisnummer is verplicht" id="D_AddressNumber" name="D_AddressNumber" type="text" value="" />
<input class="span2" id="D_AddressExtra" name="D_AddressExtra" type="text" value="" /><br />
<span class="field-validation-valid label label-important" data-valmsg-for="D_Address" data-valmsg-replace="true"></span><span class="field-validation-valid label label-important" data-valmsg-for="D_AddressNumber" data-valmsg-replace="true"></span> <br />
<input class="span4" data-val="true" data-val-required="Postcode is een verplicht veld" id="D_Zipcode" name="D_Zipcode" type="text" value="" /><span class="field-validation-valid label label-important" data-valmsg-for="D_Zipcode" data-valmsg-replace="true"></span> <br />
<input class="span4" data-val="true" data-val-required="Plaats is een verpicht veld" id="D_City" name="D_City" type="text" value="" /><span class="field-validation-valid label label-important" data-valmsg-for="D_City" data-valmsg-replace="true"></span> <br />
<input id="Submit1" type="submit" value="Versturen" class="btn btn-primary" /><br />
<div class="validation-summary-valid" data-valmsg-summary="true"><ul>
<li style="display:none"></li>
</ul></div>
</form>
在我的服务器上:
<form action="/Validatie/Quoterequest" method="post">
<input class="span6" id="D_Address" name="D_Address" type="text" value="" />
<input class="span2" data-val="true" data-val-number="The field D_AddressNumber must be a number." data-val-required="Huisnummer is verplicht" id="D_AddressNumber" name="D_AddressNumber" type="text" value="" />
<input class="span2" id="D_AddressExtra" name="D_AddressExtra" type="text" value="" /> <br /> <span class="field-validation-valid label label-important" data-valmsg-for="D_Address" data-valmsg-replace="true"></span><span class="field-validation-valid label label-important" data-valmsg-for="D_AddressNumber" data-valmsg-replace="true"></span> <br />
<input class="span4" id="D_Zipcode" name="D_Zipcode" type="text" value="" /><span class="field-validation-valid label label-important" data-valmsg-for="D_Zipcode" data-valmsg-replace="true"></span> <br />
<input class="span4" id="D_City" name="D_City" type="text" value="" /><span class="field-validation-valid label label-important" data-valmsg-for="D_City" data-valmsg-replace="true"></span> <br />
<input id="Submit1" type="submit" value="Versturen" class="btn btn-primary" /> <br />
<div class="validation-summary-valid" data-valmsg-summary="true"><ul><li style="display:none"></li> </ul></div>
</form>
我也有这个信息本地机器 IISVersion :C:\Windows\Microsoft.NET\Framework\v4.0.30319\
ProcesVersionInfo : File: C:\Program Files (x86)\IIS Express\iisexpress.exe InternalName: iisexpress.exe
OriginalFilename: iisexpress.exe.mui
FileVersion: 8.0.8418.0 (winmain(eokim).120521-1311)
FileDescription: IIS Express Worker Process
Product: Internet Information Services
ProductVersion: 8.0.8418.0
Debug: False
Patched: False
PreRelease: False
PrivateBuild: True
SpecialBuild: False
Language: Language Neutral
在服务器上:
IISVersion : C:\Windows\Microsoft.NET\Framework\v4.0.30319\
ProcesVersionInfo : File: C:\Windows\SysWOW64\inetsrv\w3wp.exe
InternalName: w3wp.exe OriginalFilename: w3wp.exe.mui
FileVersion: 7.5.7600.16385 (win7_rtm.090713-1255)
FileDescription: IIS Worker Process Product: Internet Information Services ProductVersion: 7.5.7600.16385
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: Taalonafhankelijk