===又是datalist状态保存问题?
先在一个datalist1中选定,datalist2接着从所选中读出相关数据.
private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
string ymtime=DropDownList1.SelectedItem.Value;
sql="select DISTINCT kind from [pic] where convert(varchar(10),stime,120) like '%"+ymtime+"%'";
DataSet ds=hsjdata.dbbind(sql);
DataRow row=ds.Tables["mytable"].NewRow();
row[0] = "--------";
ds.Tables["mytable"].Rows.Add(row);
DropDownList2.DataSource=ds.Tables["mytable"].DefaultView;
DropDownList2.DataTextField="kind";
DropDownList2.DataValueField="kind";
DropDownList2.DataBind();
}
private void DropDownList2_SelectedIndexChanged(object sender, System.EventArgs e)
{
string kind=DropDownList2.SelectedItem.Text;
Response.Redirect("picture.aspx?kind="+kind);
}
返回是在同一页.但DropDownList2中选过后,页面返回DropDownList2中数据就丢失拉.怎么办???