Asp.net源码专业站
首页->新知实践->Ajax三级联动和无刷新分页源码>>Handler.ashx>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Ajax三级联动和无刷新分页源码
当前文件:文件类型 myAjaxDropdownlist/Handler.ashx[2K,2009-6-12 11:48:08]打开代码结构图
普通视图
		            
1<%@ WebHandler Language="C#" Class="Handler" %> 2 3using System; 4using System.Web; 5using System.Data.SqlClient; 6using System.Data; 7 8public class Handler : IHttpHandler { 9 10 public void ProcessRequest (HttpContext context) { 11 string type = context.Request.QueryString["type"]; 12 if (type.Equals("sheng")) 13 { 14 string id = context.Request.QueryString["id"]; 15 context.Response.ContentType = "text/plain"; 16 context.Response.Write(getSheng(id));//这个是从数据库中根据传来省的id 查询出来的。市的名字和主键,主键以便去查区的名字 17 } 18 else if (type.Equals("shi")) 19 { 20 string id = context.Request.QueryString["id"]; 21 context.Response.ContentType = "text/plain"; 22 context.Response.Write(getqu(id)); 23 } 24 } 25 26 public string getqu(string shi) 27 { 28 DataSet ds = SqlDataAccess.GetAreaInfo(shi); 29 string str = ""; 30 for (int i = 0; i < ds.Tables[0].Rows.Count; i++) 31 { 32 if (i == ds.Tables[0].Rows.Count - 1) 33 { 34 str += ds.Tables[0].Rows[i]["code"].ToString() + "," + ds.Tables[0].Rows[i]["name"].ToString(); 35 } 36 else 37 { 38 str += ds.Tables[0].Rows[i]["code"].ToString() + "," + ds.Tables[0].Rows[i]["name"].ToString() + "|"; 39 } 40 } 41 return str.Trim(); 42 } 43 public string getSheng(string sheng) 44 { 45 DataSet ds = SqlDataAccess.GetCityInfo(sheng); 46 string str = ""; 47 for (int i = 0; i < ds.Tables[0].Rows.Count; i++) 48 { 49 if (i == ds.Tables[0].Rows.Count - 1) 50 { 51 str += ds.Tables[0].Rows[i]["code"].ToString() + "," + ds.Tables[0].Rows[i]["name"].ToString(); 52 } 53 else 54 { 55 str += ds.Tables[0].Rows[i]["code"].ToString() + "," + ds.Tables[0].Rows[i]["name"].ToString() + "|"; 56 } 57 } 58 return str.Trim(); 59 } 60 61 62 public bool IsReusable { 63 get { 64 return false; 65 } 66 } 67 68}
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Ajax三级联动和无刷新分页源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146