Gaurav Kapahi

Gaurav Kapahi

  • NA
  • 182
  • 0

How to get Multiple values in controler from MultiSelect Dro

Sep 6 2013 1:59 AM
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)