省市联动

   <tr style="width:567px;height:55px; border:1px solid #a0c8e0;" >
                    <td style="text-align:right;border-right:1px solid #a0c8e0">
                       家庭住址:
                    </td>
                     <td style="float:left;width:77px;height:55px;line-height:55px;margin-left:20px;" >
                         <telerik:RadDropDownList ID="Province" runat="server" AppendDataBoundItems="True" DropDownHeight="300px" AutoPostBack="True"  Width="77px" Skin="Metro" OnSelectedIndexChanged="Province_SelectedIndexChanged"  ></telerik:RadDropDownList>
           
                      
                    </td>
                       <td style="float:left;width:77px;height:55px;line-height:55px;margin-left:6px;">
                             <telerik:RadDropDownList ID="City" runat="server" AppendDataBoundItems="True" AutoPostBack="True"  Width="77px"  Skin="Metro" ></telerik:RadDropDownList>
                       </td>
                      
               </tr>

        if(!IsPostBack)
        {
            
            if (UsersInfo.UserID == "")
            {
                Response.Write("<script>alert('请先登录');window.location.href='../BackManagement/Login.aspx'</script>");
            }
            else
            {
                
                Maticsoft.Model.Uusers user_model = user_bll.GetModel(UsersInfo.UserID);//引用id所在行的数据
                Province.Items.Clear();//省 清空
                City.Items.Clear();//市 清空
                Province.Items.Add(new DropDownListItem("请选择", ""));//附上默认值请选择
                City.Items.Add(new DropDownListItem("请选择", ""));//附上默认值请选择

                DataSet da = new DataSet();
                da.ReadXml(Server.MapPath("/xml/PatentProvince.xml"));
                Province.DataSource = da;
                Province.DataTextField = "name";
                Province.DataValueField = "name";
                Province.DataBind();

                XmlDataSource xds = new XmlDataSource();
                xds.DataFile = Server.MapPath("/xml/PatentProvince.xml");
                xds.XPath = "//province[@name='" + user_model.Province + "']/city";
                City.DataSource = xds;
                City.DataTextField = "cname";
                City.DataValueField = "cname";
                City.DataBind();
                name = user_model.UuserName;
                RadTextBox1.Text = user_model.UuserName;
                RadTextBox2.Text = user_model.RealName;
                RadTextBox3.Text = user_model.Telephone;
                RadioButtonList1.Text = user_model.Sexx;
                Province.SelectedText = user_model.Province;
                City.SelectedText = user_model.City;
                RadTextBox4.Text = user_model.Address;
                RadTextBox5.Text = user_model.Email;
                RadButton1.Attributes["onclick"] = "OpenAddPro();return false;";
               
            }
           
        }      protected void Province_SelectedIndexChanged(object sender, Telerik.Web.UI.DropDownListEventArgs e)
    {
        City.Items.Clear();
       
        if (Province.SelectedText == "请选择")
        {
            City.Items.Clear();
            City.Items.Add(new DropDownListItem("请选择", ""));//附上默认值请选择
        }
        XmlDataSource xds = new XmlDataSource();
        xds.DataFile = Server.MapPath("/xml/PatentProvince.xml");
        xds.XPath = "//province[@name='" + Province.SelectedValue + "']/city";
        City.DataSource = xds;
        City.DataTextField = "cname";
        City.DataValueField = "cname";
        City.DataBind();
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值