Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Given is the following MVC razor code which creates a dropdown from a list:

@Html.DropDownList("MyTestList", null, new { @class = "btn btn-default dropdown-toggle" })

This will create the following dropdown:

dropdown

When using the code from getbootstrap.com:

<div class="dropdown">
    <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
        Dropdown
        <span class="caret"></span>
    </button>
    <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
        <li role="presentation"><a role="menuitem" tabindex="-1" href="#">test1</a></li>
        <li role="presentation"><a role="menuitem" tabindex="-1" href="#">test2</a></li>
    </ul>
</div>

It will show the dropdown like this:

image

Question: Is it possible to get the same look and feel when using @Html.DropDownList as when using the HTML code from MVC?

question from:https://stackoverflow.com/questions/26555493/how-to-apply-bootstrap-dropdown-style-to-an-asp-net-mvc-dropdownlist

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
777 views
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...