0

I am struggling for populate the MultiSelect Dropdown list by Twitter Bootstrap library in MVC. I am getting the List of data on items in JSON string format. And passing to JSON.parse($('#RetailerSelectItems').val()) but list is not enable in web page. the code as below

Inside report.js

 function BinddetailsEvents() {
 //Populate Retailer Dropdown
 var MAWBSelectItems = JSON.parse($('#MAWBSelectItems').val()); // MAWBSelectItems List of data
 var MAWBDropDown = $('#MAWBDropDown');
 $(MAWBDropDown).data('allselected', true);
 MultiSelectInit(MAWBDropDown);
 $(MAWBDropDown).multiselect('dataprovider', MAWBSelectItems);
}

Inside report.cshtml

{
 <div>
 <label>MAWB</label><br />
 <select id="MAWBDropDown" multiple="multiple" style="display: none" data-allselected="true"></select>
 </div>
}
halfer
20.2k20 gold badges111 silver badges208 bronze badges
asked Aug 24, 2016 at 12:41
5
  • not sure but try to remove this line style="display: none" Commented Aug 24, 2016 at 12:44
  • Still its not working, Now just displaying drop down box. I am able to view the list of items in Model but its not populating in list. Commented Aug 24, 2016 at 12:48
  • here is one helpful link. Click here and change the ViewBag to your model Commented Aug 24, 2016 at 12:51
  • Thanks for reply but I would like to do with above method instead by view bag. Commented Aug 24, 2016 at 13:14
  • you would have to populate the drop down list your self, the code $(MAWBDropDown).data('allselected', true); doesn't do anything in this context. loop through the items in the MAWBSelectItems and add them options to list. this might help : stackoverflow.com/questions/3446069/… Commented Aug 24, 2016 at 13:41

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.