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
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
用这个:
@Html.DropDownList("MyDropdown", MySelectList, new { @class="mycssclass" })
当你这样使用
@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>
我想这会对你有所帮助