日期:2014-05-17 浏览次数:20545 次
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="zc.aspx.cs" Inherits="DtCms.Web.Aspx.zc" EnableEventValidation="false" %> <%@ Register TagPrefix="DtContorl" Namespace="DtCms.Web.UI" Assembly="DtCms.Web.UI" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><%= SiteConfig.WebName %></title> <!-- ===== css ===== --> </head> <body onLoad="init()"> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div> <td width="200px"></td><td width="130px" align="right">籍贯:</td><td width="130px"> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID="ddlProvince" runat="server" onselectedindexchanged="ddlProvince_SelectedIndexChanged1" AutoPostBack="true"> </asp:DropDownList> <asp:DropDownList ID="ddlCity" runat="server"> </asp:DropDownList> </ContentTemplate> </asp:UpdatePanel> </td> </div> </form> </body> </html>
protected void ddlProvince_SelectedIndexChanged1(object sender, EventArgs e) { ddlCity.DataSource = bll.GetCity(ddlProvince.SelectedValue.ToString()).DefaultView;//根据页面的返回值传递信息绑定城市信息 ddlCity.DataTextField = bll.GetCity(ddlProvince.SelectedValue.ToString()).Columns[0].ToString(); ddlCity.DataBind(); }
<form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div> <table> <tr> <td width="130px" align="right"> 籍贯: </td> <td width="130px"> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID="ddlProvince" runat="server" OnSelectedIndexChanged="ddlProvince_SelectedIndexChanged1" AutoPostBack="true"> <asp:ListItem Text="1" Value="1"></asp:ListItem> <asp:ListItem Text="2" Value="2"></asp:ListItem>