6
Answers

Multi select dropdown in mvc

Photo of Vasanthakumar

Vasanthakumar

5y
1.7k
1
<select class=".my-select" chosen="{width:'100%'}" multiple data-placeholder="Recepients"
ng-model="recepients2">
<option ng-repeat="contact in contactBook">{{contact.name}}</option>
</select>
this is my code,binding data from database.
But the first data only binding into the chosen dropdown list.
other data's all not displayed.but in the inspect element its displaying.
Do you have any idea's about this guys?

Answers (6)

0
Photo of Vasanthakumar
1.4k 249 26.6k 5y
Hi Dhara, 
 
In Select2 , we can use image for Multiple dropdown list?????
 
 
0
Photo of Dhara Patel
NA 139 28 5y
Hi, You can also use selct2 in MVC multiple selection. https://select2.org/
0
Photo of Vasanthakumar
1.4k 249 26.6k 5y
Hi Nirmal, 
 
How i'm not able to get your point? 
 
0
Photo of Nirmal Dayal
678 1.3k 159.1k 5y
Hi Vasanth,
 
Put html in view
 
<select class="form-select multiselect" name="select_CompanyCode_Multiple" id="select_CompanyCode_Multiple" multiple></select>
 
Put below code in controller
  1. $scope.CompanyCode_Multiple = function () {  
  2. $scope.itemList = [];  
  3. var categCheck1 = $('#select_CompanyCode_Multiple').multiselect({  
  4. includeSelectAllOption: true,  
  5. enableFiltering: true  
  6. });  
  7. $('#select_CompanyCode_Multiple').empty();  
  8. angular.forEach($scope.CompanyCodefilter, function (value, key) {  
  9. var opt = $('<option />', {  
  10. value: value.CompanyCode1,  
  11. text: value.CompanyName  
  12. });  
  13. opt.appendTo(categCheck1);  
  14. $scope.itemList.push(opt);  
  15. });  
  16. $('#select_CompanyCode_Multiple option').attr('selected''selected');  
  17. categCheck1.multiselect('rebuild');  
  18. };  
0
Photo of Vasanthakumar
1.4k 249 26.6k 5y
how to bind this code with image from Database in dropdown list ?  
0
Photo of Farhan Ahmed
63 28.3k 15.4m 5y
https://www.c-sharpcorner.com/article/asp-net-mvc5-bootstrap-style-multi-select-dropdown-plugin/