Unable to open drop-down menu in Bootstrap-select on ASP.NET web application by clicking

Currently, as I work on developing an ASP.NET web application, I find myself facing significant challenges in getting the bootstrap-select feature to function correctly.

Despite browsing through various threads on SO for solutions, the problem remains unresolved, prompting me to seek assistance today.

Within the web application, there exists a master page that includes declarations to integrate all the necessary CSS and JavaScript files:

<head runat="server">
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=yes" />
    <meta name="description" content="" />
    <meta name="author" content="" />
    <title>MCTC - <%=Page.Title%></title>
    <link href="../Content/styles.css" rel="stylesheet" /> <!-- Bootstrap CSS -->
    <link href="../Content/themes/base/jquery-ui.css" rel="stylesheet" /> <!-- jQuery-UI CSS -->
    <link href="../Content/bootstrap-select.css" rel="stylesheet" /> <!-- Bootstrap-select CSS -->
    <link href="../content/bootstrap-datepicker3.css" rel="stylesheet"/> <!-- Bootstrap-datepicker CSS -->
    <link href="../content/mctc_styles.css" rel="stylesheet" /> <!-- custom site CSS -->
    <script src="../../scripts/jquery-3.6.0.min.js"></script>
    <script src="../../scripts/bootstrap.bundle.min.js"></script>
    <script src="../../scripts/bootstrap-select.js"></script>
    <script src="../../scripts/jquery-ui-1.13.1.js"></script>
    <script src="../../scripts/bootstrap-datepicker.js"></script>
</head>

Within the content page, a bootstrap-select element is utilized to display a list of product categories fetched through an AJAX request. Below is the HTML markup for the bootstrap-select:

        <div class="row mb-4">
            <div class="col-lg-10 offset-lg-1 text-center">
                <select class="selectpicker" id="ddlCategories" name="ddlCategories">
                    <option value="">Choose</option>
                </select>
           </div>
        </div>

At the end of the $(document).ready(function () { script part, the following 2 lines pertain to the bootstrap-select:

$('#ddlCategories').selectpicker();
loadCategories();

The invocation of loadCategories() involves the following code snippet to perform an AJAX call for retrieving a record of category items from the database:

        function loadCategories() {
            $.ajax({
                url: 'getcategories.ashx',
                data: null,
                method: 'post',
                dataType: 'json',
                    success: function(response) {
                        $('#ddlCategories').empty();
                        for (var i = 0; i < response.length; i++) {
                            alert(response[i].Category_ID + '='+response[i].Title);
                            $('#ddlCategories').append("<option value='" + response[i].Category_ID + ">" + response[i].Title + "</option>");
                        }
                        $('#ddlCategories').selectpicker('refresh'); // without the []
                },
                error: function (e) {
                    console.log(e.responseText);
                }
            });
        }

An alert call has been included to confirm data retrieval, which validates successfully.

Upon running the code, the on-screen output is as shown in the following image:

https://i.sstatic.net/4SvO8.png

No error messages appear in the console window, leaving me perplexed at the non-functioning bootstrap-select control. Despite trying multiple sequence variations of JS and CSS file loading in the master page, the issue persists, failing without any visible indication.

Your valuable assistance in resolving this matter would be immensely appreciated.

Answer №1

In a nutshell, bootstrap-select is not compatible with Bootstrap 5. After downgrading to version 4.1.3, the issue was resolved. Hoping for a quick fix!

Answer №2

It seems like there may be a version compatibility issue. The combination of software versions that has been consistently working for me up until today is:

[email protected] [email protected]

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Angular: Issue encountered while attempting to differentiate an '[object Object]'. Arrays and iterables are the only permissible types for this operation

I encountered the following error message while attempting to retrieve updated data: Error trying to diff '[object Object]'. Only arrays and iterables are allowed Snippet of Get Code: allDatas allData(data) { this.allDatas = data } Up ...

Tips for Showing Foreign Key "Name" or "Title" Instead of Using Foreign Key "ID"

I am currently facing an issue with my two tables: one is the "Souvenirs" table and the other is the "Categories" table. The Souvenir in the "Souvenirs" table has a foreign key "CategoryID" that is related to the "Categories" table. The problem arises when ...

Angular material is experiencing an issue where content is being cut off or

I am currently working on a project using AngularJS for a web application. I have encountered an issue where some of the content in the md-content element is being clipped. For instance, the body tag has the style: overflow: hidden, and the child md-conte ...

Arrange the select default option using AngularJS as the first option

I've been working on a project using Angular where I fetch data from a JSON file and push it to an array object. This data is then displayed in the options of a select element. My issue is: The default option with selection appears first, but I only ...

After clicking on the About page in Vue, my data seems to vanish into thin air

The Vue router is up and running with two pages: Home and About. Everything seems to be functioning properly, however, when I navigate to the About page and then return to the Home page, the data is lost. The page isn't refreshing, I'm simply swi ...

Ajax/PHP - unrecognized value in autofill

I have implemented this particular example to execute an ajax data query from a MySQL database, which returns a table. Currently, this setup functions correctly when text is manually entered into the input form. Example: https://i.sstatic.net/TTgLz.jpg T ...

Exploring a JavaScript multi-dimensional array

Hello everyone, I need assistance with manipulating this array: [[2,3,0],[0,4,5]] I am looking to rearrange this array as follows: [[2,0], [3,4], [0,5]] Does anyone have any suggestions on how to achieve this? I am using JavaScript for this project. ...

Implement the window.open functionality within a directive for optimal performance

I am attempting to activate the function $window.open(url, windowName, attributes); in my Angular application by using an ng-click event. I have created a directive and enclosed the window.open method within a trigger function that is connected to a butto ...

Using JQuery to locate and substitute occurrences of HTML elements throughout my webpage

Looking for assistance with a JQuery search and replace task involving multiple instances of HTML within a specific DIV element on my webpage. Specifically, I need to change certain items in the textbox to a simpler display format. Here is a snippet of th ...

Limiting Ant Design Date range Picker to display just a single month

insert image description here According to the documentation, the date range picker is supposed to display two months on the calendar, but it's only showing one month. I carefully reviewed the documentation and made a change from storing a single va ...

Initially Missing Child Props in Parent Component

I am currently working on an application that utilizes a nutrition API to fetch information such as calories and more. One of the key features I am developing is the ability for users to set their daily calorie target along with the percentage breakdown fo ...

Toggle the input box by clicking the button

How do I show or hide the input box (blue square) when I click the search button (red square)? Link Image I attempted to create the transition in CSS and also experimented with JavaScript, but the JavaScript part confused me. Here is what I tried: $(" ...

Is IronRuby Still Kicking?

I have been working as a .Net programmer and now I am considering incorporating Ruby into my current and future web applications. Upon visiting the Iron Ruby Website, I noticed that the last release was almost a year ago on March 13, 2011. There have been ...

Running a JavaScript test using the Mocha framework with an 'import' statement for a JS file

I am familiar with the module.export and require method: Requiring external js file for mocha testing While it is useful when dealing with modules, I find it inconvenient as I now need to test code in a specific file. For example, I have code in a file: ...

Trigger $q manually in AngularJS

My understanding of $q in AngularJS is that it runs every time I refresh my page, similar to using a function in ng-init. Here is the code for $q.all that I have: $q.all([$scope.getCart(), $scope.getCategory(), $scope.getMenu(), $scope.getRestaurant()]). ...

Tips for showing multiple autocomplete entries in a text box following a successful AJAX request

I'm having an issue with my code where the autocomplete multiple values, successfully retrieved by Ajax, are not being displayed. Here is the HTML I am using for display: <input type="text" name="s_to" id="s_to" class="controls"> Here is my jQ ...

Encountering an "unmatched pseudo-class :lang" error message following the Angular 14 update

Upon updating to Angular 14 and compiling the build, I encountered this error message: 1 rule skipped due to selector errors: .custom-file-input:lang(en)~.custom-file-label -> unmatched pseudo-class :lang https://i.sstatic.net/7R9Yp.png This pertain ...

At what point are watch variables accessible in the Chrome-Node-Debugger tool?

My test file runs periodically, either every minute or second, depending on how I configure it. https://i.sstatic.net/duXl5.png Despite setting watches on variables in the file, they do not populate as expected: https://i.sstatic.net/W6CFo.png Interest ...

In JavaScript, when using the fetch function with JSON, it is possible to skip the

Here's an example of fetching review data from within a 'for loop': fetch('https://api.yotpo.com/products/xx-apikey-xx/{{product.id}}/bottomline') In this case, some products may not have reviews and will return a 404 response. Th ...

Video Autoplay within an image carousel - A seamless integration

I need assistance embedding a YouTube video as the fourth item in a slideshow on my website, www.serenitygardenrooms.com. The slideshow should play the first three images and then autoplay the video before moving on to the next image. However, the code sni ...