1
Reply

How can I do parent/child in the bootstrap multiselect ?

Mani Kandan

Mani Kandan

Apr 27 2017 12:52 AM
337
I am working on MVC 5,

How can I bind a category and sub-category to be shown in the same bootstrap multiselect dropdown ?

Here is the table structure and table name is 'productcategory'.
 
 
View,
  1. <pre><script src="~/Scripts/bootstrap-multiselect.js"></script>  
  2. <link href="~/css/bootstrap-multiselect.css" rel="stylesheet" />  
  3. <script type="text/javascript">   
  4. $(function () {  
  5.         $('[id*=DDLProductCate]').multiselect({  
  6.             includeSelectAllOption: true, buttonWidth: '213%'  
  7.         });  
  8.     });  
  9. </script> 
  1. @Html.DropDownListFor(model => model.ShowAdConfigIDs, ViewData["Products"] as List<SelectListItem>, new { @id = "DDLProductCate", @class = "form-control", @multiple = "multiple" }) 
 How can I do this, inside the same DropDownList's ViewData["Products"] using C# LINQ query ?

Answers (1)