<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
using CY.SQLServerDAL;
using System.Data;
using System.Data.SqlClient;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
string id = context.Request.QueryString["ID"];
context.Response.Write(sucess(id).ToString());
}
private int sucess(string id) {
//string strsql="update c_qiuzu set Status=1 where ID="+id;
//int n=SQLHelper.ExecuteNonQuery(CommandType.Text,strsql,null);
int n = Convert.ToInt32(id) + 10;
return n;
}
public bool IsReusable {
get {
return false;
}
}
}
<script type="text/javascript">
function SendData(id)
{
var xh = new ActiveXObject("MSXML2.XMLHTTP")
xh.open("POST","HandlerA.ashx?id="+id+"&table=4",false);
xh.send();
// alert(xh.responseText);//打印XMLHTTP的返回数据
if(xh.responseText==1)
document.getElementById(id).value="已成交";
} </script>
<input id="<%#Eval("ID")%>" name="<%#Eval("ID")%>" value="<%#Eval("Status").ToString()=="1"?"已成交":"未成交" %>" type="button" οnclick="SendData(<%#Eval("ID") %>)" />