2012-09-26 29 views
0

我有一個這樣的代碼在MVC 3 @ Html.DropDownList(「SomeID」,「Select ID」) 我需要應用一些樣式到這個下拉菜單。在MVC中下拉的CSS

這不適合我「new {@ class =」dropdown「}」。

幫助我,在此先感謝。

感謝, Ramesh Kumar

回答

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> 

我認爲這將h ELP你

0

使用此:

@Html.DropDownList("MyDropdown", MySelectList, new { @class="mycssclass" })