Asp.net TextAreaFor(x=>;x.Title)Validate Meta Don';行不通
当使用ASP.NETMVC3Razor时,它不能在HTML标记中验证元信息Asp.net TextAreaFor(x=>;x.Title)Validate Meta Don';行不通,asp.net,.net,html,asp.net-mvc-3,Asp.net,.net,Html,Asp.net Mvc 3,当使用ASP.NETMVC3Razor时,它不能在HTML标记中验证元信息 <textarea rows="2" name="Title" maxlength="100" id="Title" cols="20" class="textbox inp-widx6 tit-2"> 50% OFF Andrew Christian Olympic Deep V Tee, now only £16.34 </textarea> 安德鲁·克里斯蒂安奥运会深V
<textarea rows="2" name="Title" maxlength="100" id="Title" cols="20"
class="textbox inp-widx6 tit-2">
50% OFF Andrew Christian Olympic Deep V Tee, now only £16.34
</textarea>
安德鲁·克里斯蒂安奥运会深V型T恤五折,目前仅16.34英镑
如果使用Html.TextBoxFor(x=>x.Title),则阅读器将显示以下内容
<input type="text"
value="50% OFF Andrew Christian Olympic Deep V Tee, now only £16.34"
name="Title" maxlength="100" id="Title"
data-val-required="Product title is required."
data-val-length-min="50" data-val-length-max="100"
data-val-length="The Title must be at least 50 characters &amp;
no more than 100 characters." data-val="true" class="textbox inp-widx6 tit-2" />
只需再次确认您已完成上述所有步骤
当ViewModel对象的属性名为When Title时,使用TextAreaFor方法无法进行数据批注。这不是因为MVC使用的是
data val length max
而不是maxlength
?验证属性基于模型中的属性属性。当您使用客户端验证时,它将使用TextAreaFor
开箱即用,您可以发布您的模型类吗?您是否编写了dataannotation属性来检查maxlength..只需再次确认您已经完成了所述的所有必要步骤。