使用Html.TextBoxFor带班和自定义属性(MVC) [英] Using Html.TextBoxFor with class and custom property (MVC)

查看:396
本文介绍了使用Html.TextBoxFor带班和自定义属性(MVC)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用翻译该行TextBoxFor(MVC):

How can translate that line using TextBoxFor (MVC):

<input id="Name" name="Name" type="text" data-bind="value: Name" class="title width-7" />

感谢

推荐答案

MVC 3将在HTML属性名称为连字符,所以这样的事情应该做的伎俩翻译下划线

MVC 3 will translate underscores in html attribute names into hyphens, so something like this should do the trick

@Html.TextBoxFor(m => m.Name, new { data_bind="value: Name", @class = "title width-7" })

这篇关于使用Html.TextBoxFor带班和自定义属性(MVC)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆