使用Bootstrap样式ASP.NET下拉列表 [英] Style ASP.NET Drop-Down List with Bootstrap

查看:79
本文介绍了使用Bootstrap样式ASP.NET下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我试图使用bootstrap设置下拉列表的样式,但不知道为什么在运行网页时没有任何改变。



这是我的代码:

hi Members,

I have tried to style my dropdown list using bootstrap but have no idea why nothing has changed when I run the web.

This is my code:

//aspx file
<script src="JS/jquery.min.js"></script>
<script src="JS/bootstrap-select.js"></script>
<script src="JS/bootstrap.min.js"></script>
<link href="Bootstrap/bootstrap.css" rel="stylesheet" />
<link href="Bootstrap/bootstrap-select.css" rel="stylesheet" />
<link href="Bootstrap/bootstrap.min.css" rel="stylesheet" />
<script src="Scripts/jquery-1.8.0.min.js"></script>
<script src="Scripts/bootstrap-select.min.js"></script>
<link href="Content/bootstrap-select.min.css" rel="stylesheet" />

<script type="text/javascript">

    $(document).ready(function () {
        $('#<%=NewDropDownList.ClientID%>').click(function () {
                var str = "";
                $("#<%=NewDropDownList.ClientID%> option:selected").each(function () {
                    str += $(this).val(); // OR .text() if needed
                });
                alert(str);
            });
        });

</script>

<asp:Dropdownlist ID="NewDropDownList" runat="server" Width="136px" AutoPostBack ="True" AppendDataBoundItems="true" EnableViewState="true" ViewStateMode="Enabled" CssClass="selectpicker"> 
</asp:Dropdownlist>



感谢有人可以帮我这个/推荐我设置下拉列表样式的方法,谢谢。


Appreciate if someone can help me on this/recommend me ways to style the dropdownlist, thanks.

推荐答案

文档)。就绪( function (){


' #<%= NewDropDownList.ClientID%>')。click( function (){
var str = ;
('#<%=NewDropDownList.ClientID%>').click(function () { var str = "";


#<%= NewDropDownList.ClientID%>选项:选择)。each( function (){
str + =
("#<%=NewDropDownList.ClientID%> option:selected").each(function () { str +=


这篇关于使用Bootstrap样式ASP.NET下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆