<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. tcp/ip程序

    #include<stdio.h> #include<stdlib.h> #include<errno.h> #include<string.h> #i ...

  2. 【leetcode】Longest Consecutive Sequence

    Longest Consecutive Sequence Given an unsorted array of integers, find the length of the longest con ...

  3. 【leetcode】Sudoku Solver

    Sudoku Solver Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are i ...

  4. ali2015校园招聘笔试大题

    [本文链接] http://www.cnblogs.com/hellogiser/p/ali-2015-questions.html 1. 写一个函数,输入一个二叉树,树中每个节点存放了一个整数值,函 ...

  5. 13.第一个只出现一次的字符[FindFirstNotRepeatingChar]

    [题目] 在一个字符串中找到第一个只出现一次的字符.如输入abaccdeff,则输出b. [分析] 这道题是2006年google的一道笔试题. 看到这道题时,最直观的想法是从头开始扫描这个字符串中的 ...

  6. mysql 表空间

    开启了Innodb的innodb_file_per_table这个参数之后[innodb_file_per_table = 1],也就是启用InnoDB的独立表空间模式,便于管理.此时,在新建的inn ...

  7. Sql Server 深入的探讨锁机制

    一: 当select遇到性能低下的update会怎么样? 1. 还是使用原始的person表,插入6条数据,由于是4000字节,所以两条数据就是一个数据页,如下图: 1 DROP TABLE dbo. ...

  8. Java for LeetCode 188 Best Time to Buy and Sell Stock IV【HARD】

    Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...

  9. c标签设置jsp页面的绝对路径

    <%@ page language="java" pageEncoding="UTF-8"%><%@ taglib prefix=" ...

  10. OpenGL在 win8 64bits系统下的配置

    1 program files(x86)与program files 在64位系统下,为了更好的兼容32位程序,在安装一些32位程序(注意某些程序他就是32位的),会默认扔到program files ...