我在 ASP.NET 页面中使用 DropDOwnCheckBox 作为我的控件之一。每次我尝试使用 Bootstrap 中的表单控件类时,我都没有得到任何响应。这是我的代码:
<cc1:DropDownCheckBoxes ID="ddlChkBoxLst" CssClass="form-control" runat="server" Visible="False" UseSelectAllNode="False" AddJQueryReference="true">
<%--<Style SelectBoxWidth="195" DropDownBoxBoxWidth="160" DropDownBoxBoxHeight="90"></Style>--%>
<Items>
<asp:ListItem Text="By Bank" Value="1"></asp:ListItem>
<asp:ListItem Text="By Sector" Value="2"></asp:ListItem>
<asp:ListItem Text="By Country" Value="3"></asp:ListItem>
<asp:ListItem Text="By Investment Type" Value="4"></asp:ListItem>
<asp:ListItem Text="By Location" Value="5"></asp:ListItem>
<asp:ListItem Text="By Amount" Value="6"></asp:ListItem>
</Items>
</cc1:DropDownCheckBoxes>
之前,我该如何解决?
最佳答案
您可以使用“Bootstrap Dropdown-checkbox”来实现带复选框的下拉菜单。
所有你需要做的如下:-
安装
添加 jQuery 和 Bootstrap。
在 HTML 正文和 jQuery 之后添加:-
脚本类型"text/javascript"src="/path/bootstrap-dropdown-checkbox.js"
在该部分之后添加:
link rel="stylesheet" type="text/css" href="/path/bootstrap-dropdown-checkbox.css">
您应该使用的 HTML 模板:
div class="myDropdownCheckbox"
然后,通过 jQuery 选择器:
var myData = [{id: 1, label: "Test" }];
$(".myDropdownCheckbox").dropdownCheckbox({
data: myData,
title: "Dropdown Checkbox"
});
关于c# - DropDownCheckBoxes 不响应 ASP.NET 中的 Bootstrap 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40506542/