我在页面上有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里面的内容是从数据库中读取的,请问如何实现联动啊?
蝴蝶刀刀