设置必要的属性上Html.Textbox [英] Set required attribute on Html.Textbox
本文介绍了设置必要的属性上Html.Textbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我期待建立一个引导风格的文本框,具体而言,基于以下确切的例子:
I'm looking to create a Bootstrap styled textbox, specifically, based on the exact example below:
<input class="span3" type="email" required>
下面是我到目前为止有:
Here's what I have so far:
@Html.TextBox("CustomerEmail", null, new { @class = "input-xlarge", type = "email", required = "required" })
然而, =需要必需的
显然并不只返回要求
。
所以,我的问题是,有没有什么办法可以强制它像在第一个例子需要返回使用Html.Textbox上面的时候?
So, my question is, is there any way I can force it to return required like in the first example above when using Html.Textbox?
推荐答案
我认为你应该这样使用
@Html.TextBoxFor(model => model.Name, new { @class = "text", type = "email", required = "required" })
我认为这会帮助你。
i think this will help you.
这篇关于设置必要的属性上Html.Textbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文