I'm building my first MVC application after years of doing webforms, and for some reason I am not able to make this work:
@Html.DropDownList("PriorityID", String.Empty, new {@class="textbox"} )
Error message:
System.Web.Mvc.HtmlHelper<SPDR.Models.Bug>
' does not contain a definition for DropDownList
and the best extension method overload System.Web.Mvc.Html.SelectExtensions.DropDownList(System.Web.Mvc.HtmlHelper, string, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem>, object)
has some invalid arguments
Any help greatly appreciated!
Try below code:
There are some options in constructors look, if you don't have dropdownList and you wanna insert CSS class you can use like
in this case Country is the name of your dropdown, null is for you aren't passing any generic list from your controller "Choose-Category" is selected item and last one in CSS class if you don't wanna select any default option so simple replace "Choose-Category" with ""
You Can do it using jQuery
here, Select is- html tag, Form-control is- class name
and here, SupplierId is ViewBagList, Select Supplier is - Display Name
Try this:
Try This
You can simply do this: