I need to use a Grouping in mvc4. How can I do it with mvc 4 DropDownListFor controls?
Here is a example:
Here is my real code in .cshtml for DropDownListFor:
@Html.DropDownListFor(model => model.Category, new List<SelectListItem>{
new SelectListItem() {Text = "Sales/Marketing", Value="Sales/Marketing"},
new SelectListItem() {Text = "BPO/Call Center", Value="BPO/Call Center"},
new SelectListItem() {Text = "Receptionist/Front Office", Value="Receptionist/Front Office"},
new SelectListItem() {Text = "Cook", Value="Cook"},
new SelectListItem() {Text = "Aayah/Child Caretaker", Value="Aayah/Child Caretaker"},
new SelectListItem() {Text = "Gardener", Value="Gardener"},
new SelectListItem() {Text = "Security/Guard", Value="Security/Guard"},
new SelectListItem() {Text = "Construction/Laborer", Value="Construction/Laborer"},
new SelectListItem() {Text = "Garment Tailor/Textile", Value="Garment Tailor/Textile"},
new SelectListItem() {Text = "Office Helper", Value="Office Helper"},
new SelectListItem() {Text = "Maid who can Cook", Value="Maid who can Cook"},
new SelectListItem() {Text = "Data Entry/Back Office", Value=""}},
"-- Choose Category --", new { @id = "Country", @class = "form-control", @data_error = "Choose No. of Employees is required", @required = "required" })
Even I have try to install DropDownList Optgroup MVC 1.0.0 but its not able to install on VS2012
My application framework is 4
How can I do this in client side with DropDownListFor use grouping for category?