Click here to Skip to main content
15,880,972 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm trying to get a list box using multiselect in BS5
while running the code the button is not working
if i check in inspect the data is perfectly falling inside it but don't know what the problem is

What I have tried:

<div class="col-sm-3">
                               <div class="form-group">
                                   @Html.Label("Customer ID", new { @class = "col-md-4 form-control-label" })
                                   <select name="ddl_CustID" id="ddl_CustID" class="form-control" multiple></select>
                                   @*@Html.ListBoxFor(model => model.fld_cust_id, new SelectList("", "Value", "Text"), new { @id = "ddl_CustID", @class = "form-control" })*@

                               </div>
                           </div>






$.ajax({
                   type: "GET",
                   url: '@Url.Action("GetProvCommReport", "Report")',
                   contentType: 'application/json',
                   dataType: "json",
                   //getLocationBy: "stateid"
                   error: function () {
                       var notify = $.notify('Error Error for reading location info. Please contact administrator.!', {
                           allow_dismiss: true,
                           type: 'danger'
                       });
                       return false;
                   },
                   success: function (d, status) {
                       if (status == 'success') {
                           //var obj1 = JSON.stringify(d);
                           //console.log(obj1);
                           //var obj = JSON.parse(d);
                           var options = "";
                           var duplicate = [];
                           $.each(d, function (k, v) {
                               options += "<option value='" + v["fld_cust_id"] + "'>" + v["fld_cust_id"] + "</option>";
                               console.log(v["fld_cust_id"]);
                               duplicate.push(v["fld_cust_id"]);
                           });
                           console.log(options);
                           $('#ddl_CustID').append(options);

                           $('#ddl_CustID').multiselect({ includeSelectAllOption: true, buttonWidth: '300px', selectAllValue: 0, enableFiltering: true, maxHeight: 350, dropRight: false, enableCaseInsensitiveFiltering: true });
                           $('#ddl_CustID').multiselect('refresh')
                           $('#ddl_CustID').multiselect({
                               allselectedtext: 'all',
                               multiple: true,
                               numberdisplayed: 8,
                               buttonwidth: '100%',
                               includeselectalloption: true,
                               enablefiltering: true,
                               maxheight: 150,
                               enablecaseinsensitivefiltering: true,
                               nonSelectedText: 'Select Customer ID',
                           });

                       } else {
                           var notify = $.notify('Error Error for reading location info. Please contact administrator.!', {
                               allow_dismiss: true,
                               type: 'danger'
                           });
                           return false;
                       }
                   }
               });
Posted
Updated 28-Oct-22 5:26am
Comments
Richard Deeming 27-Oct-22 3:21am    
multiselect is not a built-in method, so you must be using a plugin. But you haven't told us which one.

The jQuery Plugin Registry[^] lists quite a few options, so we can't just guess.
Richard Deeming 27-Oct-22 3:24am    
Also, since you're using Bootstrap 5, which doesn't support Internet Explorer, you can replace the jQuery ajax call with the Fetch API[^] and async functions[^], which will simplify the code.

1 solution

Please check any any extension are use for the blockers. and what plugin are you using. ex-: bootstrap or any other..?
 
Share this answer
 
Comments
Manojkumar-dll 30-Oct-22 23:50pm    
Currently there is no ad block or any extensions in the browser
i'm using multiselect in Bootstrap 5

and its working in Bootstrap 3 and lso checked with Bootstrap 4 not working on it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900