我想将 Bootstrap 框架与 http://silviomoreto.github.io/bootstrap-select/ 一起使用.它只是不起作用。下面是代码。请帮忙。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Final_Year_Project_Allocation_System.silviomoreto_bootstrap_select_d4ec9bd.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<link href="bootstrap-select.css" rel="stylesheet" type="text/css" />
<link href="bootstrap-select.css" rel="stylesheet" type="text/css" />
<script src="../bootstrap/js/bootstrap.js" type="text/javascript"></script>
<script src="bootstrap-select.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server" >
<div>
<select class="selectpicker">
<option>Mustard</option>
<option>Ketchup</option>
<option>Relish</option>
</select>
</div>
</form>
</body>
</html>
请帮忙。
最佳答案
我没有看到对实际 bootstrap.css
的引用?
你需要有类似的东西(注意顺序 - 这很重要):
<link href="bootstrap.css" rel="stylesheet" type="text/css" />
<link href="bootstrap-select.css" rel="stylesheet" type="text/css" />
然后是JS
<script src="../bootstrap/js/bootstrap.js" type="text/javascript"></script>
<script src="../bootstrap/js/bootstrap-select.js" type="text/javascript"></script>
当然要确保路径正确。
编辑
我也很确定 boostrap.js 依赖于 jquery - 所以确保你也包含它(在 bootsrap.js)。
编辑 2
我还怀疑你的路径不正确。如果这是您的 javascript 的路径:
"../bootstrap/js/bootstrap.js"
那么你的 css 的路径很可能是(假设你只是按原样删除 Bootstrap 并且没有将它放在不同的文件夹中):
"../bootstrap/css/bootstrap.css"
关于c# - 扩展 Bootstrap 选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16663314/