我把计算出来的页数绑定到了dropDownList上,我在SelectedIndexChanged事件里面应该怎么写呢??
private void initialize()
{
this.lblCurrentPage.Text="1";
this.databindTodl();
//计算总共有多少记录
RecordCount = CalculateRecord();
//计算搜索到的记录
this.lblRecordCount.Text = RecordCount.ToString();
//计算总共有多少页
PageSize=9;
PageCount = (float)RecordCount/PageSize>(int)RecordCount/PageSize?RecordCount/PageSize+1:RecordCount/PageSize; //
lblPageCount.Text = PageCount.ToString();
//ViewState["PageCount"] = PageCount;
//绑定到dropdownlist上
for(int i=1;i<=PageCount;i++)
{
this.ddlPage.Items.Add(new ListItem(i.ToString()));
}
}
下面是我在SelectedIndexChanged事件中写的代码,但是当数字变化了以后,页面却没有变化
private void ddlPage_SelectedIndexChanged(object sender, System.EventArgs e)
{
for(int i=1;i<=this.ddlPage.Items.Count;i++)
{
if(this.ddlPage.SelectedValue==i.ToString())
{
this.databindTodl();
}
}
}
请各位不吝赐教。
[此贴子已经被作者于2007-5-4 16:23:44编辑过]