使用带有ASP.net Web窗体的Bootstrap Switch组件 [英] Using Bootstrap Switch component with ASP.net Web Form

查看:80
本文介绍了使用带有ASP.net Web窗体的Bootstrap Switch组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



最近我一直在尝试使用Bootstrap Switch作为我的ASP.net Web Form CheckBox组件。当我加载页面时,我可以看到开关,但是当我点击时,没有任何反应。下面是我的代码:



Hi everyone,

Recently I have been trying to use Bootstrap Switch for my ASP.net Web Form CheckBox component. When I load the page, I can see the switch, but when I click, nothing happens. Below here is my code :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="BootStrap_Test.index" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

    <!-- Bootstrap Core CSS -->
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet" />

    <!-- Custom CSS -->
    <link href="css/bootstrap-switch.css" rel="stylesheet" />

    <script src="js/jquery-1.11.1.js"></script>
    <script src="bootstrap/js/bootstrap.js"></script>
    <script src="js/bootstrap-switch.js"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            start_switch();
        });

        function start_switch() {
            $(".custom_check").bootstrapSwitch();
        }
    </script>

    <title></title>
</head>
<body data-spy="scroll" data-target=".navbar-fixed-top">
    <form id="form1" runat="server">
	
        <section class="container">
            <div class="col-md-12">
                <div class="row">
                    <asp:CheckBox ID="CheckBox2" CssClass="custom_check" checked runat="Server" OnCheckedChanged="CheckBox2_CheckedChanged" />
                </div>
            </div>
        </section>
		
    </form>
	
</body>
</html>

推荐答案

document )。ready( function (){
start_switch();
});

function start_switch(){
(document).ready(function () { start_switch(); }); function start_switch() {


.custom_check)。bootstrapSwitch();
}
< / 脚本 >

< title > < / title >
< / head >
< 正文 data-spy = 滚动 data-目标 = .navbar-fixed-top >
< 表格 id = form1 runat = server >

< section class = 容器 >
< div < span class =code-attribute> class = col-md-12 >
< div class = row >
< asp:CheckBox ID = CheckBox2 CssClass = custom_check 已检查 runat = 服务器 OnCheckedChanged = CheckBox2_CheckedChanged / < span class =code-keyword>>
< / div >
< / div >
< /部分 >

< / form >

< / body >
< / html >
(".custom_check").bootstrapSwitch(); } </script> <title></title> </head> <body data-spy="scroll" data-target=".navbar-fixed-top"> <form id="form1" runat="server"> <section class="container"> <div class="col-md-12"> <div class="row"> <asp:CheckBox ID="CheckBox2" CssClass="custom_check" checked runat="Server" OnCheckedChanged="CheckBox2_CheckedChanged" /> </div> </div> </section> </form> </body> </html>


试试这个。



更改

Try this.

Change


这篇关于使用带有ASP.net Web窗体的Bootstrap Switch组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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