大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
liandong.aspx:
------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="liandong.aspx.cs" Inherits="WebApplication1.liandong" %>无标题页
liandong.aspx.cs
-------------------------------------------------------------------------------------------
using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; namespace WebApplication1 { public partial class liandong : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { string sql = "select * from t_ld where pid=0"; DataTable dt = DBhelper.query(sql); foreach (DataRow dr in dt.Rows) { ListItem li = new ListItem(dr["name"].ToString(), dr["id"].ToString()); this.DropDownList1.Items.Add(li); } } } } }
liandong.ashx.cs
using System; using System.Collections; using System.Data; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Linq; namespace WebApplication1 { ////// $codebehindclassname$ 的摘要说明 /// [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class liandong1 : IHttpHandler { public void Proce***equest(HttpContext context) { context.Response.ContentType = "text/html"; if(!string.IsNullOrEmpty(context.Request.QueryString["pid"])) { int pid = Convert.ToInt32(context.Request.QueryString["pid"]); string sql = "select * from t_ld where pid=" + pid; DataTable dt = DBhelper.query(sql); string json_str = ""; json_str += "["; foreach (DataRow dr in dt.Rows) { json_str += "{\"id\""; json_str += ":"; json_str += "\"" + dr["id"].ToString() + "\""; json_str += ","; json_str += "\"name\""; json_str += ":"; json_str += "\"" + dr["name"].ToString() + "\""; json_str += "}"; json_str += ","; } json_str = json_str.Substring(0, json_str.Length - 1); json_str += "]"; context.Response.Write(json_str); } } public bool IsReusable { get { return false; } } } }
创新互联www.cdcxhl.cn,专业提供香港、美国云服务器,动态BGP最优骨干路由自动选择,持续稳定高效的网络助力业务部署。公司持有工信部办法的idc、isp许可证, 机房独有T级流量清洗系统配攻击溯源,准确进行流量调度,确保服务器高可用性。佳节活动现已开启,新人活动云服务器买多久送多久。