求教DropDownList实现分页跳转
求教高手,怎么用DropDownList实现girdview分页跳转?我的部分代码如下,无法跳转,请问错在哪里?应该怎么改?protectedvoidbindtodg(i...
求教高手,怎么用DropDownList实现girdview分页跳转?我的部分代码如下,无法跳转,请问错在哪里?应该怎么改?
protected void bindtodg(int myclassid)
{
........
this.topicdg.DataSource = dt;
this.topicdg.DataBind();
this.nowpage.Text = (this.topicdg.PageIndex + 1).ToString();
this.totalpage.Text = this.topicdg.PageCount.ToString();
this.pagelist.Items.Clear();
for (int i = 1; i <= this.topicdg.PageCount; i++)
{
this.pagelist.Items.Add(i.ToString());
}
this.pagelist.SelectedIndex = this.topicdg.PageIndex;
}
protected void pagelist_SelectedIndexChanged(object sender, EventArgs e)
{
this.topicdg.PageIndex = this.pagelist.SelectedIndex;
bindtodg(1);
}
AutoPostBack已设为true 展开
protected void bindtodg(int myclassid)
{
........
this.topicdg.DataSource = dt;
this.topicdg.DataBind();
this.nowpage.Text = (this.topicdg.PageIndex + 1).ToString();
this.totalpage.Text = this.topicdg.PageCount.ToString();
this.pagelist.Items.Clear();
for (int i = 1; i <= this.topicdg.PageCount; i++)
{
this.pagelist.Items.Add(i.ToString());
}
this.pagelist.SelectedIndex = this.topicdg.PageIndex;
}
protected void pagelist_SelectedIndexChanged(object sender, EventArgs e)
{
this.topicdg.PageIndex = this.pagelist.SelectedIndex;
bindtodg(1);
}
AutoPostBack已设为true 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询