当DropDownList1 文本框里的值变动,DropDownList2值就根据 DropDownList1 查询数据!我不知道我的表达对不对
! 是那个事件! 我要怎么操作@
也就是说 DropDownList1 文本是 院区  DropDownList2 就显示 院区下面的科室! 

解决方案 »

  1.   


            protected void ddlProvince_SelectedIndexChanged(object sender, EventArgs e)
            {
                for (int i = this.ddlCity.Items.Count - 1; i >= 0; i--)
                {                this.ddlCity.Items.RemoveAt(i);            }
                for (int i = this.ddlCounty.Items.Count - 1; i >= 0; i--)
                {                this.ddlCounty.Items.RemoveAt(i);
                }
                string ProvinceId = this.ddlProvince.SelectedValue;
                ddlBindCity(ProvinceId);
            }        绑定地区
            public void ddlBindCity(string _provinceid)
            {            string strSelect = "select City_ID,City_name from City where Province_ID='" + _provinceid + "'";
                DbHelper db = new DbHelper();
                this.ddlCity.DataSource = db.ExecuteDataTable(db.GetSqlStringCommond(strSelect));
                this.ddlCity.DataTextField = "City_name";
                this.ddlCity.DataValueField = "City_Id";
                this.ddlCity.DataBind();        }
    这个可以参考下
      

  2.   

                 L_YuanQu_server lyuu = new L_YuanQu_server();
                DataTable dt = lyuu.getdropyuu();
                this.DropDownList1.DataSource = dt;
                this.DropDownList1.DataTextField = "name";
                this.DropDownList1.DataValueField = "id";
                this.DropDownList1.DataBind();
    我把这个 放到我的DropDownList1_SelectedIndexChanged对吗
      

  3.   


    L_YuanQu_server lyuu = new L_YuanQu_server();
      DataTable dt = lyuu.getdropyuu();
      this.DropDownList1.DataSource = dt;
      this.DropDownList1.DataTextField = "name";
      this.DropDownList1.DataValueField = "id";
      this.DropDownList1.DataBind();你这个是绑定 DropDownList1 的数据源
    你应该在DropDownList1_SelectedIndexChanged
    事件里 根据DropDownList1的value来查询出数据 绑定到DropDownList2很典型的下拉框联动  坛子里一搜很多的