從我從你的描述中可以理解,如果你把你的過濾代碼比頁面加載事件:
嘗試使用這樣的事情,而不是:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
// executed only first time
// load data for both list control and drop down
}
}
protected void DropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
// filter the data
// (or clear the items in the list control and fetch new data for the list
// control based on the status id selected in the drop down and rebind it)
}
不要忘記設置的AutoPostBack =「真」的下拉控制,否則SelectedIndexChanged事件不會導致回傳和數據當你改變選擇時(在一些其他控件導致回發之後)將不會被過濾。
你能發表一些代碼嗎? – 2010-11-29 11:00:01