MissioDei
MissioDei

Reputation: 809

Set the width of a Html Helper drop down list

I've several ways of doing it like this, to no avail:

<div class="editor-field">
          @Html.DropDownListFor("ManufacturerId", String.Empty, new { style="width:500px" })
          @Html.ValidationMessageFor(model => model.ManufacturerId)
     </div>

Thanks for any tips!

Upvotes: 3

Views: 8022

Answers (2)

StriplingWarrior
StriplingWarrior

Reputation: 156524

The general gist of what you're doing should work, but it looks like your arguments may be a little confused. How about:

@Html.DropDownList("ManufacturerId", Enumerable.Empty<SelectListItem>(), 
    new{ style="width: 500px;"})

Upvotes: 2

ebb
ebb

Reputation: 9377

@Html.DropDownList("ManufacturerId", Enumerable.Empty<SelectListItem>(),  
    new { @style = "width: 500px;" }) 

Upvotes: 3

Related Questions