<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>        //防止页面的刷新

<asp:DropDownList ID="drop_sheng" runat="server" AutoPostBack="True" onselectedindexchanged="drop_sheng_SelectedIndexChanged" DataTextField="name" DataValueField="id">
</asp:DropDownList>
<asp:DropDownList ID="drop_qu" runat="server" AutoPostBack="True">
</asp:DropDownList>

</ContentTemplate>
</asp:UpdatePanel>

protected void Bindshengfen()
{
drop_sheng.DataSource = DB.GetDataSet("id,name", "shengfen", "parentid=0", "id asc");
drop_sheng.DataTextField = "name";
drop_sheng.DataValueField = "id";
drop_sheng.DataBind();
drop_sheng.Items.Insert(0, new ListItem("省份", ""));
}
protected void Binddiqu()
{
drop_qu.DataSource = DB.GetDataSet("id,name", "chengshi", "parentid='" + drop_sheng.SelectedValue.ToString() + "'", "idasc");
drop_qu.DataTextField = "name";
drop_qu.DataValueField = "id";
drop_qu.DataBind();
drop_qu.Items.Insert(0, new ListItem("城市", ""));
}
protected void drop_sheng_SelectedIndexChanged(object sender, EventArgs e)
{
Binddiqu();
}

省份+城市---Dropdownlist控件的应用的更多相关文章

  1. DropDownList控件

    1.DropDownList控件 <asp:DropDownList runat="server" ID="DropDownList1" AutoPost ...

  2. DropDownList 控件不能触发SelectedIndexChanged 事件

    相信DropDownList 控件不能触发SelectedIndexChanged 事件已经不是什么新鲜事情了,原因也无外乎以下几种: 1.DropDownList 控件的属性 AutoPostBac ...

  3. 三级联动---DropDownList控件

    AutoPostBack属性:意思是自动回传,也就是说此控件值更改后是否和服务器进行交互比如Dropdownlist控件,若设置为True,则你更换下拉列表值时会刷新页面(如果是网页的话),设置为fl ...

  4. c#中DropDownList控件绑定枚举数据

    c# asp.net 中DropDownList控件绑定枚举数据 1.枚举(enum)代码: private enum heros { 德玛 = , 皇子 = , 大头 = , 剑圣 = , } 如果 ...

  5. DropDownList 控件

    今天打算学习下dropdownlist控件的取值,当你通过数据库控件或dataset绑定值后,但又希望显示指定的值,这可不是简单的值绑定就OK,上网搜了一些资料,想彻底了解哈,后面发现其中有这么大的奥 ...

  6. DropDownList控件学习

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...

  7. 【React】开发一个城市选择控件

    想到做这个,是因为无意中在github上看到了这一个仓库https://github.com/lunlunshiwo/ChooseCity,做的就是一个城市选择控件,是用vue写的,说的是阿里的一道题 ...

  8. 客户端用JavaScript填充DropDownList控件 服务器端读不到值

    填充没有任何问题,但是在服务器端却取不出来下拉表中的内容.页面代码如下. <form id="form1" runat="server"> < ...

  9. DropDownList 控件的SelectedIndexChanged事件触发不了

    先看看网友的问题: 根据Asp.NET的机制,在html markup有写DropDownList控件与动态加载的控件有点不一样.如果把DropDownList控件写在html markup,即.as ...

随机推荐

  1. linux screen 命令详解(未验证+研究)

    一.背景 系统管理员经常需要SSH 或者telent 远程登录到Linux 服务器,经常运行一些需要很长时间才能完成的任务,比如系统备份.ftp 传输等等.通常情况下我们都是为每一个这样的任务开一个远 ...

  2. Python: 什么是*args和**kwargs

    转自: http://blog.sina.com.cn/s/blog_65a8ab5d0101fglm.html http://blog.csdn.net/chenjinyu_tang/article ...

  3. 【SpringMVC】SpringMVC系列10之视图与视图解析器

    10.视图与视图解析器 10.1.概述     请求处理方法执行完成后,最终返回一个 ModelAndView处理方法,Spring MVC 也会在内部将它们装配成一个ModelAndView 对象, ...

  4. 【转】ByteArrayOutputStream和ByteArrayInputStream详解

    ByteArrayOutputStream类是在创建它的实例时,程序内部创建一个byte型别数组的缓冲区,然后利用ByteArrayOutputStream和ByteArrayInputStream的 ...

  5. 42.旋转数组的最小元素[Get min value of rotated array]

    [题目] 把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转.输入一个排好序的数组的一个旋转,输出旋转数组的最小元素.例如数组{3, 4, 5, 1, 2}为{1, 2, 3, 4, 5 ...

  6. JavaEE面试题库

    Java EE软件工程师 认证考试 面试题大全 目  录 第一部分  HTML/CSS/JavaScript 1 1.              HTML含义和版本变化... 1 2.         ...

  7. 解决 jersey javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119)

    检查是否Jar冲突 保留一个jersey-server-*.jar

  8. ECSHOP去版权与标志

    前台部分: 1:去掉头部TITLE部分的ECSHOP演示站 Powered by ecshop 前者在后台商店设置 - 商店标题修改 后者打开includes/lib_main.php $page_t ...

  9. Linux下循环、选择、顺序操作

    1.Shell脚本数组操作小结 http://www.jb51.net/article/52382.htm Linux Shell在编程方面比Windows批处理强大很多,无论是在循环.运算. bas ...

  10. php 面向对象要点汇总

    //类和对象//对象:一切东西都可以看做对象,对象是类的实例化.//类:类是对象的抽象,用来描述众多对象共有的特征. //定义类 class//成员变量 和 成员方法//访问修饰符 public共有的 ...