Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net TextAreaFor(x=>;x.Title)Validate Meta Don';行不通_Asp.net_.net_Html_Asp.net Mvc 3 - Fatal编程技术网

Asp.net TextAreaFor(x=>;x.Title)Validate Meta Don';行不通

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

当使用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型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;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..只需再次确认您已经完成了所述的所有必要步骤。