我可以在@ Html.Editor中使用模式在MVC中吗?

时间:2017-01-12 09:19:56

标签: regex asp.net-mvc

我们可以使用模式(正则表达式)进行输入控制 那样:

<input type="text" name="country_code" pattern="[A-Za-z]{3}" title="Three letter country code">

我的问题是我可以在@html.Editor中使用模式吗?

我试着用这种方式:

@Html.Editor("country_code", null, new { htmlAttributes = new { @class = "form-control" , required = "required" , pattern="[A-Za-z]{3}"} })

pattern =&#34; [A-Za-z] {3}&#34; 无法识别

0 个答案:

没有答案