Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

How to implement chosen plugin for MVC 3 ?

for this type of output

enter image description here

share|improve this question
Did you read the documentation? Have you tried something already? Did you encounter some specific difficulties? – Darin Dimitrov 18 hours ago
Yes I rad the documentation and tried now working fine. But problem is I cant found ID after selecting email Id. e.g.entry in database EmailID = [email protected] & ID=125 I cant found "ID=125" anywhere. – Imran 16 hours ago
add comment (requires an account with 50 reputation)

2 Answers

please visit the following link.this will help you to implement chosen plugin with mvc3. i found this helpful for me.here is the link

http://utsavized.com/chosen-multiselect-dropdown-list-with-asp-net-mvc3/

share|improve this answer
add comment (requires an account with 50 reputation)

I have reconfigure chosen plugin as below and working properly.

My razor :

<div style="width: 750px; clear: both; margin-left: 170px;">

            @Html.ListBox(
                             "Emailaddress",
                             ViewBag.EmailaddressList as MultiSelectList,
                             new { @class = "chosen-select", data_placeholder = "Choose a Emailaddress...", style = "width:750px;", tabindex = "4" }
                         )
</div> 

Add this script after your html Razor code

<script src="@Url.Content("~/Scripts/chosen.js/chosen.jquery.js")" type="text/javascript"></script>
        <script type="text/javascript">
            var config = {
                '.chosen-select': {},
                '.chosen-select-deselect': { allow_single_deselect: true },
                '.chosen-select-no-single': { disable_search_threshold: 10 },
                '.chosen-select-no-results': { no_results_text: 'Oops, nothing found!' },
                '.chosen-select-width': { width: "95%" }
            }
            for (var selector in config) {
                $(selector).chosen(config[selector]);
            }
  </script>

My viewbag :

ViewBag.Skills = new MultiSelectList(EmailaddressList, "Id", "EmailId");
share|improve this answer
add comment (requires an account with 50 reputation)

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.