三级联动
来源:互联网 发布:php开源后台管理系统 编辑:程序博客网 时间:2024/06/09 16:45
客户端:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList2_SelectedIndexChanged">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList3" runat="server">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
服务端:
public partial class 三¨y级?联¢a动¡¥ : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DropDownList1.DataSource = ElectronMaster.DBHelper.GetTable("select * from T_System_Province");
DropDownList1.DataTextField = "ProvinceName";
DropDownList1.DataValueField = "ProvinceId";
DropDownList1.DataBind();
DropDownList1.Items.Insert(0,new ListItem("***请选择***"));
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList2.DataSource = ElectronMaster.DBHelper.GetTable("select * from T_System_City where ProvinceId=" + DropDownList1.SelectedItem.Value+ "");
DropDownList2.DataTextField = "CityName";
DropDownList2.DataValueField = "CityId";
DropDownList2.DataBind();
DropDownList2.Items.Insert(0, new ListItem("***请选择***"));
}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList3.DataSource = ElectronMaster.DBHelper.GetTable("select * from T_System_Area where CityId=" + DropDownList2.SelectedItem.Value + "");
DropDownList3.DataTextField = "AreaName";
DropDownList3.DataValueField = "AreaId";
DropDownList3.DataBind();
DropDownList3.Items.Insert(0, new ListItem("***请选择***"));
}
}
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动!
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- Java处理Access问题杂症
- 实用C++函数:取当前模块句柄
- 常用的html代码 加粗 加亮 字型加大 变色等
- PS CS5应用抽出滤镜为MM抠图换背景的教程
- 视图、过程、触发器实例
- 三级联动
- [手记]wx保护卡完成的任务
- document.getElementById使用
- MSSQL导入导出语句大全
- linux设置系统时间
- mysql 备份数据
- Delphi通过 RTTI信息重构类方法的原始声明
- 几款微博同步工具比较
- 用C++实现属性