首页 新闻 会员 周边

如何在asp.net mvc3中,指定textfor的name属性

0
悬赏园豆:10 [已解决问题] 解决于 2013-01-25 11:15

使用@Html.TextBoxFor(m => Model.UserName, new { @class = "inputCell2", size = "10" })在视图页中生成的html代码中有.net自设的name属性

<input class="inputCell2" id="UserName" name="Entity.UserName" size="10" type="text" value="" />

我想改成:

<input class="inputCell2" id="UserName" name="user" size="10" type="text" value="" />

试用@Html.TextBoxFor(m => Model.UserName, new { @class = "inputCell2", size = "10", @name = "user" })却没反应

请大家帮忙解决一下,谢谢,急啊

kevinwang32的主页 kevinwang32 | 初学一级 | 园豆:123
提问于:2013-01-19 10:36
< >
分享
最佳答案
-2

 @Html.TextBox("user", @Model.UserName, new { @class = "inputCell2", size = "10" })

收获园豆:5
爬上墙头等红杏。 | 初学一级 |园豆:4 | 2013-01-19 11:19

我要的是在TextBoxFor上进行操作,但似乎会扯到MVC模板的问题,就采纳你的方法吧

kevinwang32 | 园豆:123 (初学一级) | 2013-01-25 11:15
其他回答(1)
0

@Html.TextBox 可以看看这个方法的参数。

收获园豆:5
chenping2008 | 园豆:9836 (大侠五级) | 2013-01-19 21:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册