新手一个~最近在做级联遇到点问题!
调试运行的时候打开页面如下:

这时候1,2,3 三个下拉列表数据正确,逻辑是对的。但是当我改变1的内容后,2会变并且正确,但是3就不变了,如下图

这时候我再改变2的时候,3会变并且正确。。。唯独只改变1的时候 3不变。。。
后台代码:
protected void Page_Load(object sender, EventArgs e)
{
//判断是否第一次进入页面,如果是,则绑定数据库;如果不是,则无需绑定。
if (!this.IsPostBack)
{
//绑定河流
SqlConnection con = new SqlConnection("Server=.;Uid=sa;Pwd=123456;Database=szpg_new;MultipleActiveResultSets=true");
con.Open();
string cmdText = "select* from River";
SqlCommand cmd = new SqlCommand(cmdText, con);
SqlDataReader sdr = cmd.ExecuteReader();
this.DropDownList1.DataSource = sdr;
this.DropDownList1.DataTextField = "RiverName";//文本内容
this.DropDownList1.DataValueField = "RiverCode"; //数据源字段
this.DropDownList1.DataBind();
//sdr.Close();
//绑定区段
string cmdZoneText = "select* from Zone where RiverCode=" + this.DropDownList1.SelectedValue;
SqlCommand cmdZone = new SqlCommand(cmdZoneText, con);
sdr = cmdZone.ExecuteReader();
this.DropDownList2.DataSource = sdr;
this.DropDownList2.DataTextField = "ZoneName";//文本内容
this.DropDownList2.DataValueField = "ZoneCode"; //数据源字段
this.DropDownList2.DataBind();
//绑定断面
string cmdSectionText = "select* from Section1 where ZoneCode=" + this.DropDownList2.SelectedValue;
SqlCommand cmdSection = new SqlCommand(cmdSectionText, con);
sdr = cmdSection.ExecuteReader();
this.DropDownList3.DataSource = sdr;
this.DropDownList3.DataTextField = "SectionName";//文本内容
this.DropDownList3.DataValueField = "SectionCode"; //数据源字段
this.DropDownList3.DataBind();
//关闭连接
con.Close();
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
//河流的ID
string RiverCode = this.DropDownList1.SelectedValue;
SqlConnection con = new SqlConnection("Server=.;Uid=sa;Pwd=123456;Database=szpg_new");
con.Open();
SqlCommand cmd = new SqlCommand("select * from Zone where RiverCode=" + RiverCode, con);
SqlDataReader sdr = cmd.ExecuteReader();
//绑定
this.DropDownList2.DataSource = sdr;
this.DropDownList2.DataTextField = "ZoneName";
this.DropDownList2.DataValueField = "ZoneCode";
this.DropDownList2.DataBind();
//sdr.Close();
//con.Close();
}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
string ZoneCode = this.DropDownList2.SelectedValue;
SqlConnection con = new SqlConnection("Server=.;Uid=sa;Pwd=123456;Database=szpg_new");
con.Open();
SqlCommand cmd = new SqlCommand("select * from Section1 where ZoneCode=" + ZoneCode, con);
SqlDataReader sdr = cmd.ExecuteReader();
//绑定
this.DropDownList3.DataSource = sdr;
this.DropDownList3.DataTextField = "SectionName";
this.DropDownList3.DataValueField = "SectionCode";
this.DropDownList3.DataBind();
}