Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have Multi Select dropdownlist but i am not able to get Multiple value as whenever I am clicking button it is taking first selected value from dropdown list i.e refreshed and shows only first value selected. 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" })
Posted
Updated 5-Sep-13 23:32pm
v3
Comments
BillWoodruff 6-Sep-13 2:49am    
Please clarify if this question uses ASP.NET to manipulate jQuery, and C#. If it does use ASP.NET please add that tag to the question. If this question involves only jQuery, and JavaScript, please re-tag the question.
Ruter11 6-Sep-13 5:28am    
It is ASP .Net MVC Razor and Jquery to create MultiSelected Drop Down List...I changed the question little bit please see again

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900