MVC3 样式问题

@Html.EditorFor(model => model.mobileNum, new { @class = "mpn" })

想给这句话加上自定义的class,但是怎么也显示不出 

始终显示这样的效果:

<input class="text-box single-line" data-val="true" data-val-length="手机号不多于20字符" data-val-length-max="20" data-val-remote="用户账号已存在" data-val-remote-additionalfields="*.mobileNum" data-val-remote-url="/Test/CheckMobileExists" id="mobileNum" name="mobileNum" type="text" value="" />

如何加上自定义的样式,请高手指教!


GCT1015
浏览 500回答 2
2回答

慕盖茨4494581

@Html.EditorFor(model => model.mobileNum, new { @class = "mpn"&nbsp;})goes to@Html.TextBoxFor(model => model.mobileNum, new { @class = "mpn"&nbsp;})Because the default template for EditorFor does not support custom attribution.

摇曳的蔷薇

首先支持1楼,另外@Html.TextBoxFor(model => model.mobileNum, new { @class = "mpn test"&nbsp;})test可以是其他的样式文件名,与前面的样式名隔开。
打开App,查看更多内容
随时随地看视频慕课网APP