日期:2014-05-18 浏览次数:20524 次
//页面中放入两个DropDownList <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" onselectedindexchanged="DropDownList1_SelectedIndexChanged"> </asp:DropDownList> <asp:DropDownList ID="DropDownList2" runat="server"> </asp:DropDownList>
------解决方案--------------------
protected void ddlistName_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList1.SelectedValue == "请选择")
{
return;
}
string strValue = DropDownList1.SelectedValue
DataSet ds = 你方法(strValue);
ddlistInformation.DataSource = ds;
ddlistInformation.DataTextField = "绑定字段";
ddlistInformation.DataValueField = "绑定字段";
ddlistInformation.DataBind();
ddlistInformation.Items.Insert(0, new ListItem("请选择", "请选择"));
}
dropdownlist autopostback属性设为true
------解决方案--------------------
上面错了 是 DropDownList1_SelectedIndexChanged