0

i have a code like this in MVC 3 @Html.DropDownList("SomeID", "Select ID") i need to apply some styles to this Dropdown.

this doesn't working for me " new { @class="dropdown" }".

Help me, thanks in advance.

Thanks, Ramesh Kumar

4

2 回答 2

0

用这个:

 @Html.DropDownList("MyDropdown", MySelectList, new { @class="mycssclass" })
于 2012-09-27T19:55:09.503 回答
0

当你这样使用

@Html.DropDownList("SomeID", "Select ID")

那么这不起作用" new { @class="dropdown" }"

所以为了使用你的CSS然后你像这样使用

<div class="editor-field">
@Html.DropDownListFor(model => model.CountryId, new SelectList(Model.Countries, "ID", "Name"), "select", new { @ID = "ddlCountry", @class = "text", Style = "width: 150px;", onchange = "javascript:cascadingdropdown();" })
    @Html.ValidationMessageFor(model => model.Citys.countryID)
</div>

我想这会对你有所帮助

于 2012-09-26T13:46:05.533 回答