开发者

Using Html.TextBoxFor with class and custom property (MVC)

How can translate that line using TextBoxFor (MVC):开发者_StackOverflow

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

Thanks


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" })


For example,

if you want to add data-mask

@Html.TextBoxFor(m => m.BirthDate, new { @class = "form-control", data_mask = "date" })

it will generate in html

data-mask="date"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜