ASP.NET DropDownListCheckBox
程序员文章站
2022-06-26 11:14:45
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Chec...
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CheckBoxList.aspx.cs" Inherits="CheckBoxList" %> <!DOCTYPE html> <html xmlns="https://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link href="lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" /> <script src="lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script> <script src="lib/ligerUI/js/core/base.js" type="text/javascript"></script> <script src="lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script> <script src="lib/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script> <script src="lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { var manager; $.get("CheckBoxHandle.ashx?tem=" + Math.random() + "&selectValue=" + $("#HiddenField1").val(), function (value) { if (value.lastIndexOf("[") >= 0) { $("#JSON").val(value); var data = eval('(' + value + ')'); manager = $("#test1").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true, data: data, valueFieldID: 'test3', onSelected: function (newvalue) { //这个是用于在后台获取的 $("#HiddenField1").val(newvalue); } }); } else { //解决回发问题 var data = eval('(' + $("#JSON").val() + ')'); manager = $("#test1").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true, data: data, valueFieldID: 'test3', onSelected: function (newvalue) { //这个是用于在后台获取的 $("#HiddenField1").val(newvalue); } }); manager.selectValue(value); } }); }); function clickee() { alert($("#test3").val()); } </script> </head> <body> <form id="form1" runat="server"> <p> <input type="text" id="test1" /> <asp:HiddenField ID="HiddenField1" ClientIDMode="Static" runat="server" /> <asp:HiddenField ID="JSON" ClientIDMode="Static" runat="server" /> <asp:Button ID="Button1" OnClick="Button1_Click" OnClientClick="clickee();" runat="server" Text="获取" /> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </p> </form> </body> </html>
<p>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;</p><p>public partial class CheckBoxList : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {</p><p> } protected void Button1_Click(object sender, EventArgs e) { this.Label1.Text = this.HiddenField1.Value; } }</p>
推荐阅读
-
创建基于ASP.NET core 3.1 的RazorPagesMovie项目(一)-创建和使用默认的模板
-
ASP.NET Core Web API 最佳实践指南
-
使用NuGet将我们的ASP.NET Core类库打包并将程序包(类库)发布到NuGet平台上进行管理
-
Linux下自动化部署ASP.NET CORE 3.1(Docker+Jenkins+Nginx)
-
创建基于ASP.NET core 3.1 的RazorPagesMovie项目(三)-已搭建基架的Razor页面解释和更新
-
【架构篇】ASP.NET Core 基于 Consul 动态配置热更新
-
使用ASP.NET Core 3.x 构建 RESTful API - 5.1 输入验证
-
Jexus 5.8.2正式发布! 为Asp.Net Core生产环境提供平台支持
-
asp.net下利用JS实现对后台CS代码的调用方法
-
asp.net(c#)复数类(复数加减乘除四则运算)