我在頁面上有2個dropdownlist控件,我希望另外一個dropdownlist的內容取決于另外一個的選擇, protected void ddpM_Type_SelectedIndexChanged(object sender, EventArgs e){ string strWhere = "DelFlag = 'false'"; if (this.ddpM_People.SelectedValue == "內部維修") { ddpM_Company.Items.Clear(); ddpM_Company.DataTextField = "Dept_Name"; ddpM_Company.DataValueField = "Dept_ID"; bindList(ddpM_Company, department.GetList(strWhere).Tables[0]); } if (this.ddpM_People.SelectedValue == "外委維修") { ddpM_Company.Items.Clear(); ddpM_Company.DataTextField = "C_Name"; ddpM_Company.DataValueField = "C_ID"; bindList(ddpM_Company, corporations.GetList(strWhere).Tables[0]); }}但是這樣沒效果,我dropdownlist里面的內容是從數據庫中讀取的,請問如何實現聯動啊?
- 3 回答
- 0 關注
- 581 瀏覽
添加回答
舉報
0/150
提交
取消