Peter M. Peter M. - 1 month ago 9
ASP.NET (C#) Question

How to change width of html.DropDownListFor()

I have small design question about

html.DropDownListFor()


How can I change width of
html.DropDownListFor()
??
For example by css.

Thanks for answers

Answer

Have you tried Html.DropDownListFor( new {width:"100"})

or Html.DropDownListFor( new {@class:"longDropdownList"})

EDIT

<style>
    .MakeWide { width: 200px; }
</style>

<%= Html.DropDownListFor(x => x.Name, new SelectList(new List<string>()), new { @class = "MakeWide" })%>