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

这个是根据LigerUI改的,解决了回发问题
ASP.NET DropDownListCheckBox使用示例(解决回发问题)_第1张图片 
资料地址
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;
}
}

}


你可能感兴趣的:(ASP.NET DropDownListCheckBox使用示例(解决回发问题))