<%@ WebHandler Language="C#" Class="GetcityByProvinceIDHandler" %>
using System;
using System.Web;
using System.Web;
public class GetcityByProvinceIDHandler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
//context.Response.Write("Hello World");
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
//context.Response.Write("Hello World");
int ID=Convert.ToInt32( context.Request["ID"]);//取到传过来的ID值
BLL.StaticDataBll bll = new BLL.StaticDataBll();
System.Data.DataTable table = bll.getCityByProvinceID(ID);//得到市的数据源
System.Data.DataTable table = bll.getCityByProvinceID(ID);//得到市的数据源
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach (System.Data.DataRow row in table.Rows)
{
sb.Append(row["ID"].ToString()).Append("|").Append(row["FName"].ToString()).Append("$");
{
sb.Append(row["ID"].ToString()).Append("|").Append(row["FName"].ToString()).Append("$");
//context.Response.Write(row[]);
//sb.Append(row["ID"].ToString()).Append("|");
}
}
context.Response.Write(sb.ToString().Trim('$'));
}
public bool IsReusable {
get {
return false;
}
}
}
}
public bool IsReusable {
get {
return false;
}
}
}