Mike
Mike

Reputation: 2463

ASP.NET MVC ComboBox

I'm trying to create a ComboBox for a ASP.NET MVC5 application. Is this as simple as:

  1. Create a Select in a razor page
  2. Add an input field as an option
  3. Then add options from the data past to the view

How should the search functionality of the input be written? In JavaScript/JQuery or something else? An example would be great! Is there any build in things to create this, maybe something like comboboxfor from the asp.net mvc side? Does Twitter-Bootstrap have anything built in?

I understand comboboxes as explained here. I don't think it would be hard to implement, I just want to implement it the correct way.

Heres a picture of something that I want the results to look like

enter image description here

Upvotes: 0

Views: 1884

Answers (1)

Dextere
Dextere

Reputation: 301

Bootstrap-Buttons with dropdowns:

<form>
<div class="row">
<div class="col-lg-6">
    <div class="input-group">
        <input type="text" class="form-control" />
        <div class="input-group-btn">
            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu pull-right">
                <li><a href="#">Action</a></li>
                <li><a href="#">Another action</a></li>
                <li><a href="#">Something else here</a></li>
            </ul>
        </div>
    </div>
</div>
</div>
</form>

Upvotes: 2

Related Questions