Asp. Net Razor View Html. Textbox Size/Width

Is there a way to set a textbox size without using CSS (setting the columns or size attribute) ? If so, how?

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

3 Answers

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

or you could try with this:

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

Sounds like you're looking for Html.TextArea:

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

if you have added bootstrap then you can check input properties and modify

e.g changing height

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest