Python语言技术文档

微信小程序技术文档

php语言技术文档

jsp语言技术文档

asp语言技术文档

C#/.NET语言技术文档

html5/css技术文档

javascript

点击排行

您现在的位置:首页 > 技术文档 > C#/.NET入门教程

ASP.NET DropDownListCheckBox使用示例(解决回发问题)

来源:中文源码网    浏览:127 次    日期:2024-05-03 00:41:01
【下载文档:  ASP.NET DropDownListCheckBox使用示例(解决回发问题).txt 】


ASP.NET DropDownListCheckBox使用示例(解决回发问题)
这个是根据LigerUI改的,解决了回发问题 资料地址 http://ligerui.com/demos/comboBox/comboBoxMul.htm 具体代码 复制代码 代码如下: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="CheckBoxList.aspx.cs" Inherits="CheckBoxList" %>
复制代码 代码如下:

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;

public partial class CheckBoxList : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {

} protected void Button1_Click(object sender, EventArgs e) { this.Label1.Text = this.HiddenField1.Value; } }

复制代码 代码如下:

<%@ WebHandler Language="C#" Class="CheckBoxHandle" %>

using System; using System.Web; using System.Collections.Generic;

public class CheckBoxHandle : IHttpHandler { public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/plain"; string select = context.Request.QueryString["selectValue"].ToString(); if (string.IsNullOrEmpty(select)) { List list = new List(); list.Add(new Type { ID = 1, Name = "SAm" }); list.Add(new Type { ID = 2, Name = "Tom" }); list.Add(new Type { ID = 3, Name = "jim" }); context.Response.Write(JsonHelper.GetJSONString(list)); } else { //解决回发问题 context.Response.Write(select); } } public bool IsReusable { get { return false; } }

}

相关内容