protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList1.AutoPostBack = true;
Class1 cc = new Class1();
string k = DropDownList1.SelectedItem.Text;
DataTable l = cc.table1(k);
GridView g = new GridView();
g.DataSource = l;
g.DataBind();
}
答案 0 :(得分:0)
您需要设置AutoPostBack=true
before
DropDownList1_SelectedIndexChanged
才能使其生效。如果之前未将AutoPostBack设置为true,DropDownList1_SelectedIndexChanged将永远不会被触发。
您可以在设计时在page_load事件中设置AutoPostBack=true
。