dropdownlist无刷新联动方法集合

http://www.cnblogs.com/gwazy/archive/2005/05/10/152312.aspx 

demo:http://www.cnblogs.com/Files/gwazy/WebService.rar

[多级联动下拉选择框]和[Tree to Tree] 续http://webuc.net/dotey/archive/2004/08/13/1651.aspx

Ajax实现无刷新三联动下拉框http://singlepine.cnblogs.com/archive/2006/01/18/257954.html

无刷新三级联动:http://blog.csdn.net/allenlf/archive/2006/08/13/1056581.aspx

二级联动不同浏览器:http://oftengo.com/info/450-1.htm

解答:http://www.lemongtree.com/zh-cn/item.0000102.aspx

SqlConnection con = new SqlConnection("server=localhost;database=gswebDB;uid=sa;pwd=;");
    SqlDataAdapter da = new SqlDataAdapter("select ClassName,ClassID from classname where ClassLevel=1",con);
    DataSet ds = new DataSet();
    da.Fill(ds);
    this.DropDownList1.DataSource=ds.Tables[0].DefaultView;
    this.DropDownList1.DataTextField = "ClassName";
    this.DropDownList1.DataValueField = "ClassID";
    this.DropDownList1.DataBind();
    
this.DropDownList1.Attributes.Add("onchange","load(this.options[this.selectedIndex].value)"); 
//将ClassID作为参数传递给脚本函数load(ClassID),如果要传递的是ClassName,应将value改为innerText,但如果大类为中文,则调用小类时出现无法显示的问题
   // 
this.DropDownList2.Attributes.Add("onChange","javascript:document.Form1.TH.value=this.options[this.selectedIndex].value;");   //读取DropDownList2的值,将其赋给一个TextBox控件TH,以获取DropDownList2的值,为获取DropDownList2的值,网上有人说可通过使用隐藏的TextBox控件来获取,我未能实现,因为在客户端隐藏的TextBox控件也是不可用脚本来访问的,没法给其赋值,我只能通过将其样式、字体颜色设于背景相同来达到隐藏效果,这是一个很笨的方法,有谁有好的方法,请帮我。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值