Home Bootstrap-select attributes in Razor/.Net Core
Reply: 0

Bootstrap-select attributes in Razor/.Net Core

user5590
1#
user5590 Published in September 20, 2018, 12:43 pm

I'm having trouble applying bootstrap-select attributes for drop down list form inputs in my .NET Core project. In particular I would like to apply the live search attribute.

1 - I have tried the following code. It is in a Razor page, and the '_' syntax is advised here. This successfully applies the Bootstrap style (see screenshot) but not the additional attributes:

                @Html.DropDownListFor(m => m.Observation.BirdId, new SelectList(Model.Birds, "BirdId", "EnglishName"),
                    new {
                      @class = "form-control selectpicker",
                      data_width = "auto",
                      data_live_search = "true",
                    //data_show_subtext = "true",
           })

Here's the screenshot. It shows the Bootstrap style was successfully applied, but not the live search feature. This list will eventually contain ~600 options so a search feature is required.

2 - I have also tried applying the following code - in a blank Razor page - lifted directly from the bootstrap-select documentation. The result is the same: it applies the Bootstrap style but not the live search functionality. Or indeed any other attribute that I have tried:

  <select class="selectpicker" data-live-search="true">
        <option data-tokens="ketchup mustard">Hot Dog, Fries and a Soda</option>
        <option data-tokens="mustard">Burger, Shake and a Smile</option>
        <option data-tokens="frosting">Sugar, Spice and all things nice</option>
 </select>

I have tried all sorts over the last couple of days. Does anyone have any suggestions? Thank you.

share|improve this question

1 Answer 1

active oldest votes
up vote 0 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.492691 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO