Reputation: 1312
Hi I want to make my textbox's width longer.
The view that is generated, uses @Html.EditorFor which I noticed I can't modify nor I can add css style to it.
So I checked, TextAreFor and it works but it creates a scrollbar since it is a textarea
@Html.TextAreaFor(model => model.Name, new { cols=50, @rows=1 })
How would I remove the scrollbar? so it looks like it is a textbox? or is there another way to generate a textbox with a custom width?
Thanks,
Upvotes: 0
Views: 1711
Reputation: 3217
Maybe
@Html.TextBoxFor(m => m.Name, new { @style="width:150px; height:50px; overflow:hidden;" })
Upvotes: 0
Reputation: 218702
You can use TextBoxFor
HTML Helper method for generating a input element with a custom class like this
@Html.TextBoxFor(m => m.Name, new { @class="yourCustomClass" })
and now you can define your custom styles in this class
.yourCustomClass
{
width:340px;
}
Upvotes: 1