<script type="text/javascript">
</script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("~/App_Data/ProvinceAndCity.xml"));
XmlNodeList nodes = doc.DocumentElement.ChildNodes;
foreach (XmlNode xd in nodes)
{
this.ddlProvince.Items.Add(xd.Attributes["Name"].Value);
int n = this.ddlProvince.Items.Count - 1;
this.ddlProvince.Items[n].Value = (xd.Attributes["Name"].Value);
}
XmlElement root = doc.DocumentElement;
XmlNode node = root.SelectSingleNode(@"Province[@Name='" + this.ddlProvince.SelectedValue + "']");
foreach (XmlNode xd in node.ChildNodes)
{
this.ddlCity.Items.Add(xd.Attributes["Name"].Value);
}
}
}
// protected void ddlProvince_SelectedIndexChanged(object sender, EventArgs e)
{
this.ddlCity.Items.Clear();
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("~/App_Data/ProvinceAndCity.xml"));
XmlElement root = doc.DocumentElement;
XmlNode node = root.SelectSingleNode(@"Province[@Name='" + this.ddlProvince.SelectedValue + "']");
foreach (XmlNode xd in node.ChildNodes)
{
this.ddlCity.Items.Add(xd.Attributes["Name"].Value);
}
this.ddlCity.UpdateAfterCallBack = true;
}