就是级联吧:
public void DropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
EmployeeBll empbll = new EmployeeBll();
// DropDownList2.Items.Remove(DropDownList2.Items.FindByText("--请选择--"));
for (int i = 0; i < this.DropDownList1.Items.Count; i++)
{
if (this.DropDownList1.Items[i].Selected)
{
int dpid = Int32.Parse(this.DropDownList1.SelectedValue);
DataSet myds = empbll.GetEmpByDpid(dpid);
this.DropDownList2.DataSource = myds;
this.DropDownList2.DataValueField = "empid";
this.DropDownList2.DataTextField = "empname";
this.DropDownList2.DataBind();
}
}
}
把国家做为主表,市作为子表。绑定的时候先绑定国家,绑定市的时候,就根据你选择国家的I D来绑定市。这就行了。你要不明白,再找我。