AspNetPager 分页 保存查询状态

bychgh bychgh 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
用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();
}





...全文

相关推荐

评论 10
收藏 已收藏
分享
返回顶部
bychgh
.NET社区 62,272 成员 668,968 内容