This is changed according to Ligerui, solve the problem of postback
Data address
Http://ligerui.com/demos/comboBox/comboBoxMul.htm
Specific code
Copy Code code as follows:
<%@ Page language= "C #" autoeventwireup= "true" codefile= "CheckBoxList.aspx.cs" inherits= "CheckBoxList"%>
<! DOCTYPE html>
<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) {
This is used in the background to get the
$ ("#HiddenField1"). Val (NewValue);
}
});
} else {
Resolve postback problem
var data = eval (' + $ (' #JSON '). Val () + ') ');
Manager = $ ("#test1"). Ligercombobox ({
Isshowcheckbox:true, Ismultiselect:true,
Data:data, Valuefieldid: ' Test3 ', onselected:function (newvalue) {
This is used in the background to get the
$ ("#HiddenField1"). Val (NewValue);
}
});
Manager.selectvalue (value);
}
});
});
function Clickee () {
Alert ($ ("#test3"). Val ());
}
</script>
<body>
<form id= "Form1" runat= "Server" >
<div>
<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=" get "/>
<asp:label id= "Label1" runat= "Server" text= "Label" ></asp:Label>
</div>
</form>
</body>
Copy Code code as follows:
<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>
Copy Code code as follows:
<p><%@ WebHandler language= "C #" class= "Checkboxhandle"%>< /p><p>using System;
using System.Web;
using System.collections.generic;</p><p>public class Checkboxhandle:ihttphandler {
public void Pr Ocessrequest (HttpContext context) {
context. Response.ContentType = "Text/plain";
String select = Context. request.querystring["Selectvalue"]. ToString ();
if (string. IsNullOrEmpty (Select))
{
List<type> List = new list<type> ();
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
{
/Resolve postback issue
context. Response.Write (select);
}
}
public bool IsReusable {
Get {
] false;
}
}</p><p>}</p>