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" })
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Sep 5, 2013, 10:20 PM EDT
Try like this.
Gaurav Kapahi132 reputationPosted Sep 6, 2013, 1:34 AM EDT
Jignesh TrivediRank #16 · 50.3K reputationPosted Sep 6, 2013, 1:56 AM EDT
Have you add jquery code suggested by the web site?
i.e.
$(function(){
$("select").multiselect();
});
also check whether you are adding supported jquery files.
hope this will help you.
Gaurav Kapahi132 reputationPosted Sep 6, 2013, 2:00 AM EDT
Gaurav Kapahi132 reputationPosted Sep 6, 2013, 2:25 AM EDT
@using (@Html.BeginForm("Index", "ICCRpt"))
Controller:
Jignesh TrivediRank #16 · 50.3K reputationPosted Sep 6, 2013, 2:37 AM EDT
Gaurav Kapahi132 reputationPosted Sep 6, 2013, 2:38 AM EDT
//
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts