<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();
}
省市联动
最新推荐文章于 2024-05-29 13:35:10 发布