You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I got some specific situation when I used asp-... tag helpers.
I think it is not a bug in bootstrap-select and I just want to describe situation and how to do workaround.
Imagine you have ViewModel and populate options to a selectpicker with tag-helper:
This will generate html with not specified properties. So, multiple selection will be turned on and .selectpicker('val', 'Value'); will not work. And, to resolve this I implemented with "old-school" MVC approach
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I got some specific situation when I used asp-... tag helpers.
I think it is not a bug in bootstrap-select and I just want to describe situation and how to do workaround.
Imagine you have ViewModel and populate options to a selectpicker with tag-helper:
<div> <select id="selectCompanies" asp-for="Companies" asp-items="Model.Companies" class="selectpicker" data-live-search="true" data-style="btn-outline-dark" title="Company"> </select> </div>
This will generate html with not specified properties. So, multiple selection will be turned on and .selectpicker('val', 'Value'); will not work. And, to resolve this I implemented with "old-school" MVC approach
<div> <select id="selectCompanies2" class="selectpicker" data-live-search="true" data-style="btn-outline-dark" title="Company"> @{ foreach (var item in Model.Companies) { <option>@item.Text</option> } } </select> </div>
PS sorry for formatting
Beta Was this translation helpful? Give feedback.
All reactions