How do you set the width of an HTML Helper TextBox in ASP.NET MVC?

The original answer is no longer working as written:

<%=Html.TextBox("test", new { style="width:50px" })%> 

will get you a text box with “{ style=”width:50px” }” as its text content.

To adjust this for the current release of MVC 1.0, use the following script (note the addition of the second parameter – I have mine starting as blank, adjust accordingly based on your needs):

<%=Html.TextBox("test", "", new { style="width:50px" })%> 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)