ASP.NET Razor查看Html.TextBox的大小/宽度

时间:2012-04-10 08:48:42

标签: asp.net razor

有没有办法在不使用CSS的情况下设置文本框大小(设置列或大小属性)?如果是这样,怎么样?

 @Html.TextBox("redeemamt", @Model.Amount)

3 个答案:

答案 0 :(得分:30)

@Html.TextBox("redeemamt", @Model.Amount, new {style = "width: 100px;"})

或者你可以试试这个:

@Html.TextBox("redeemamt", @Model.Amount, new { size = "100" })

答案 1 :(得分:5)

听起来你正在寻找Html.TextArea:

@Html.TextArea((string)name, (string)value, (int)rows, (int)columns, (object)htmlAttributes)

答案 2 :(得分:0)

如果添加了bootstrap,则可以检查输入属性并修改

例如改变身高

input[type="text"]
height: 25px;
line-height: 25px;