I am working on a .NET web application that has multiple views for selecting from database tables.
Using Bootstrap 4.3, I have successfully generated the list but now need to include a 'Select All' option to streamline the selection process.
Below is the relevant section from the .cshtml file:
<div class="form-group">
<label asp-for="Products" class="control-label"></label>
<select asp-for="Products" class="form-control" asp-items="ViewBag.AllProducts" size="10"></select>
</div>
The list of products displayed in ViewBag.AllProducts is generated by one of my controllers based on a model.
After researching similar solutions, it seems like I may need to implement a JavaScript script to add the 'Select All' feature. However, most examples I found involved predefined option lists instead of using ViewBag.
I attempted the following approach without success:
$(".multiselect", this.el).multiselect({
includeSelectAllOption: true
});
If anyone has any advice or guidance on whether my solution is on the right track, I would greatly appreciate it.