Ajax实现三层级联3
来源:互联网 发布:ga域名 编辑:程序博客网 时间:2024/05/17 22:39
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Text;
namespace Warehouse
{
public partial class DropDownHelper2 : System.Web.UI.Page, IHttpHandler//, IRequiresSessionState
{
protected void Page_Load(object sender, EventArgs e)
{
//Response.Write("cao l nengdaozhelema");
string a = Request["type1"];
Response.Write(a);
SqlConnection mycon = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
string sql = "select WS_Name,WS_Id from W_Warehouse,W_Sort where WS_Warehouse=WW_Id and WW_Id='" +a+ "'";
SqlDataAdapter myda = new SqlDataAdapter(sql, mycon);
DataSet myset = new DataSet(); myda.Fill(myset);
DataTable mytable = myset.Tables[0];
int n = mytable.Rows.Count;
String str = "";
for (int i = 0; i < n; i++)
{
string Sort = mytable.Rows[i]["WS_Name"].ToString();
string SortId = mytable.Rows[i]["WS_Id"].ToString();
if (i >= 1)
str += "|";
str += "\"" + Sort + ":" + SortId + "\"";
}
Response.Write(str);
}
}
}
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Text;
namespace Warehouse
{
public partial class DropDownHelper2 : System.Web.UI.Page, IHttpHandler//, IRequiresSessionState
{
protected void Page_Load(object sender, EventArgs e)
{
//Response.Write("cao l nengdaozhelema");
string a = Request["type1"];
Response.Write(a);
SqlConnection mycon = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
string sql = "select WS_Name,WS_Id from W_Warehouse,W_Sort where WS_Warehouse=WW_Id and WW_Id='" +a+ "'";
SqlDataAdapter myda = new SqlDataAdapter(sql, mycon);
DataSet myset = new DataSet(); myda.Fill(myset);
DataTable mytable = myset.Tables[0];
int n = mytable.Rows.Count;
String str = "";
for (int i = 0; i < n; i++)
{
string Sort = mytable.Rows[i]["WS_Name"].ToString();
string SortId = mytable.Rows[i]["WS_Id"].ToString();
if (i >= 1)
str += "|";
str += "\"" + Sort + ":" + SortId + "\"";
}
Response.Write(str);
}
}
}
此代码也是后台代码,前台默认即可!到此使用ajax实现三级下拉列表级联已完成,代码中可能涉及到数据库操作,做相应改变即可!
0 0
- Ajax实现三层级联3
- Ajax实现三层级联1
- Ajax实现三层级联2
- ajax 实现3级联动
- ajax+json实现级联
- 使用ajax实现级联
- ajax如何实现级联
- Ajax实现省市级联
- AJAX实现级联下拉框
- Ajax + Asp实现级联菜单
- Ajax + Asp实现级联菜单
- ajax级联菜单的实现
- AJAX实现二级级联菜单
- jdbc+ajax实现级联菜单
- jquery用ajax实现级联
- Jquery Ajax 提交 级联实现
- AJAX实现省市级联 JS
- 利用Ajax实现动态级联
- [Codeforces 125E] MST Company (单度限制最小生成树)
- hadoop学习笔记1----构造模块与集群安装ssh与启动Hadoop
- 优秀程序员的10个习惯
- NYOJ 30 Gone Fishing(贪心)
- hibernate配置
- Ajax实现三层级联3
- javascript去掉url的一个参数
- cocos2dx 不要直接在 onEnter 里面 addTargetedDelegate (或 addStandardDelegate)
- C语言随笔(指针)
- Using OpenCV with gcc and CMake
- dom4j如何获取节点的行数,列数
- Remove Duplicates from Sorted List I&II and Sorted Array I&II
- .net中Global.asax中的事件详解
- HDU 1385 Minimum Transport Cost