Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Would like to request for help. Thanks in advance for help.

What I have tried:

CSHTML FILE:
HTML
<div>
    @Html.DropDownList("MySkills", (IEnumerable< SelectListItem >)ViewBag.MySkills, new {id = "normalDropDown"})
</div>
@section scripts{
<script>
           $(function () {
               $("normalDropDown").chosen();
        });
    </script>
 }


_LAYOUT.CSHTML FILE
HTML
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    <link href="~/Content/chosen.css" rel="stylesheet" />
   </head>
<body>
    
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    <script src="~/Scripts/chosen.jquery.min.js"></script>
    @RenderSection("scripts", required: false)
</body>
</html>
Posted
Updated 25-Jan-19 9:38am
Comments
MadMyche 25-Jan-19 10:30am    
Can you please update the question to include the "rendered html" from using the Browser's "View Source" function; it gives another view of potential problems.
Also, does the developer tools (such as Firebug) show any scripting errors?
F-ES Sitecore 25-Jan-19 10:55am    
We don't know what this "chosen" plug-in is and "not working" doesn't give enough information to know what the problem might be.

1 solution

Oh, sorry for missing the info. So, adding two main articles which I have follow.

Chosen: A jQuery Plugin by Harvest to Tame Unwieldy Select Boxes[^]
or
Asp.Net MVC - Searchable and Multi-select Drop DownList Using Chosen Plugin - YouTube[^]

Of, course i will also accept any other solution for creating a searching box inside of dropdownlist.

I have to admit I have just start learning MVC from last 2 weeks (to late). More experience have old in asp.net forms. And, from my perspective, it is not so easy migrations.
 
Share this answer
 
v2

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