页面比较简单,一个DropDownList,一个GridView ,list选中的时候GridView 重新绑定一次,调试结果是这样的,开始绑定都正常, 然后重新选中list page IsPostBack是true,然后执行DdselectType_SelectedIndexChanged里的代码都很正常,执行后又到Page_Load里IsPostBack竟然是false,数据又重新绑定了,结果..... 但是页面显示list选中还是我后来选中的值, 大家帮忙看下,是page生命周期配明白还是问题在哪?
protected void Page_Load(object sender, EventArgs e)
{
string conns = hiddconn.Value;
if (!this.Page.IsPostBack)
{
Bing();
JQGrid1.DataSource = GetDateSet(DdselectType.Text);
JQGrid1.DataBind();
}
}
public void DdselectType_SelectedIndexChanged(object sender, EventArgs e)
{
JQGrid1.DataSource = GetDateSet(DdselectType.Text);
JQGrid1.DataBind();
}