Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,
I am using mvc5. I built one application for multiselect dropdownlist. I download and add js & css file for multiselect but it is not working



Application is running good.. but multiselect dropdown is not come..pls help me to solve this issue:


Controller:
<pre lang="cs">public ActionResult Index()
{

var emp = new Class1();
emp.emlist.Add(new SelectListItem() { Text = &quot;Select Employee&quot;, Value = &quot;0&quot; });
var employeelist = t.customers.ToList();
foreach(var v in employeelist)
{
emp.emlist.Add(new SelectListItem() { Text = v.name, Value = v.ID.ToString() });
}

return View(emp);
}</pre>


View:

@model multiselect.Models.Class1

@{
ViewBag.Title = "Index";
}

<h2>Index</h2>
&lt;script src="~/Content/jquery-multiselect.js">&lt;/script>
<link href="~/Content/jquery-multiselect.css" rel="stylesheet" />
@Html.ListBoxFor(model => model.eid, new System.Web.Mvc.MultiSelectList(Model.emlist, "Value", "Text", Model.emlist), new { @class = "emplist" })
<pre lang="xml">&lt;script type=&quot;text/javascript&quot;&gt;
$(function () {
$(&quot;.emplist&quot;).multiselect({ multiple: true, header: &quot;Select status&quot; });
});
&lt;/script&gt;</pre>
Posted

1 solution

Please refer the following article:

Working With DropDownList in MVC 5 Using jQuery
 
Share this answer
 
Comments
prabu19 26-Mar-14 4:30am    
Thanks for your reply.. But i asked multiselect dropdown

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