使用ASP.NET MVC 3 Razor时,它无法读取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>
如果使用Html.TextBoxFor(x =&gt; 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" />
答案 0 :(得分:0)
重新确认您已遵循所有步骤提到的步骤。
http://www.codeproject.com/Articles/422573/Model-Validation-in-ASP-NET-MVC