7
Answers

How to get Multiple values in controler from MultiSelect Dro

Gaurav Kapahi

Gaurav Kapahi

11y
2.4k
1
I have Multi Select dropdownlist but i am not able to get Multiple value Please let me know how can I get multiple value in controller. I am using this jquery link for multi select :  http://www.erichynds.com/examples/jquery-ui-multiselect-widget/demos/


Controller:

ActionResult Index(string MatchTypeName, string CompetitionName, string MatchName, string GroundName, string ReportName)
       {
           foreach (WebReportType WebRepots in db.WebReportTypes)
           {
               SelectListItem selectReportType = new SelectListItem
               {
                   Text = WebRepots.ReportName,
                   Value = WebRepots.ReportName,
                   //Selected = selected != null && selected.Contains(idx.ToString())
               };

               SelectReports.Add(selectReportType);

               ViewBag.ReportName = SelectReports;
           }
return view();
}



View:

@Html.DropDownList("ReportName",  ViewData["ReportName"] as MultiSelectList, new { multiple = "multiple", @class = "multiselect" ,  style = "width: 200px" })
Answers (7)