AspNetPager 分页 保存查询状态
用AspNetPager 分页控件,结合下拉框的条件查询的,点击下一页的时候,下拉框重新绑定了,如何改动?
private string state = "1";
private BLL.LeaveInfo lea_bll = new BLL.LeaveInfo();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
leave_status();
Get_LeaveInfo();
}
}
public void leave_status()
{
this.ddl_status.Items.Add(new ListItem("未审核", "1"));
this.ddl_status.Items.Add(new ListItem("已批准", "2"));
this.ddl_status.Items.Add(new ListItem("已否决", "3"));
}
public void Get_LeaveInfo()
{
int count = 0;
this.rp_list.DataSource = lea_bll.GetList(this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex, "lid", true, " l_state='" + state + "'", out count);
this.rp_list.DataBind();
this.AspNetPager1.RecordCount = count;
AspNetPager1.CustomInfoHTML = "<font color='#000'>记录总数:</font><font color=\"blue\"><b>" + AspNetPager1.RecordCount.ToString() + " </b></font>";
AspNetPager1.CustomInfoHTML += "<font color='#000'>总页数:</font><font color=\"blue\"><b>" + AspNetPager1.PageCount.ToString() + " </b></font>";
AspNetPager1.CustomInfoHTML += "<font color='#000'>当前页:</font><font color=\"red\"><b>" + AspNetPager1.CurrentPageIndex.ToString() + " </b></font>";
}
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.ddl_status.SelectedValue))
{
state = this.ddl_status.SelectedValue;
}
this.Get_LeaveInfo();
}
protected void Query_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.ddl_status.SelectedValue))
{
state = this.ddl_status.SelectedValue;
}
AspNetPager1.CurrentPageIndex = 1;
Get_LeaveInfo();
}
...全文
相关推荐
ASP.NET分页功能的实现
使用AspNetPager控件实现ASP.NET分页功能 “控件+源代码”!!
掌握ASP.NET分页技术:AspNetPager控件应用详解
AspNetPager是针对ASP.NET应用程序开发的一个高效的分页控件,它可以很容易地集成到任何基于.NET的Web应用程序中,尤其是ASP.NET。它的主要用途是简化Web应用程序中的数据分页操作,使开发者能够摆脱编写复杂的分页代码,提高开发效率。分页功能的优势主要体现在以下几个方面:用户体验提升:通过分页控件,用户可以更加方便地在大量数据中导航,无需加载所有数据到内存中,从而提高页面的响应速度。减少服务器压力。
商业编程-源码-AspNetPager分页控件6.0源码.zip
商业编程-源码-AspNetPager分页控件6.0源码.zip
asp.net分页方法和 简单实用,应用到项目后台中,棒极了!
C# ASP.NET 分页是Web应用程序中最常用到的功能之一,AspNetPager 自定义样式:两种选择 有源码和文件,安装后直接用
Asp.net通用分页控件
asp.net通用分页控件AspNetPager7.2


