asp.net中,怎么实现dropdownlist对repeater内容筛选后分页?
使用aspnetpage控件,分页和筛选功能都能实现,但是两个在一块,筛选后一点分页,筛选的内容自动刷新成dropdownlist的第一个选项的筛选了,求解怎么解决?后台...
使用aspnetpage控件,分页和筛选功能都能实现,但是两个在一块,筛选后一点分页,筛选的内容自动刷新成dropdownlist的第一个选项的筛选了,求解怎么解决?
后台筛选实现代码:
protected void Unnamed1_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList1.Text == "全选")
{ bandData("1=1"); }
else
{
string sql = " select floor.id,area.name as area,precinct.name as precinct,village.name as village,floor.name as floor from area area " +
" left join area precinct on area.id = precinct.fid " +
" left join area village on precinct.id = village.fid " +
" left join area floor on village.id = floor.fid " +
" where precinct.fid = any(select id from area where fid = 0) and village.fid = any(select id from area) " +
" and floor.fid = any(select id from area) " +
" and area.id = '" + DropDownList1.SelectedValue + "' ";
DataTable dt = Maticsoft.DBUtility.DbHelperSQL.Query(sql).Tables[0];
aspnetpage1.RecordCount = dt.Rows.Count;
PagedDataSource pds = new PagedDataSource();
pds.AllowPaging = true;
pds.PageSize = aspnetpage1.PageSize;
pds.CurrentPageIndex = aspnetpage1.CurrentPageIndex - 1;
pds.DataSource = dt.DefaultView;
RpArea.DataSource = pds;
RpArea.DataBind();
}
}
在线等,谢谢 展开
后台筛选实现代码:
protected void Unnamed1_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList1.Text == "全选")
{ bandData("1=1"); }
else
{
string sql = " select floor.id,area.name as area,precinct.name as precinct,village.name as village,floor.name as floor from area area " +
" left join area precinct on area.id = precinct.fid " +
" left join area village on precinct.id = village.fid " +
" left join area floor on village.id = floor.fid " +
" where precinct.fid = any(select id from area where fid = 0) and village.fid = any(select id from area) " +
" and floor.fid = any(select id from area) " +
" and area.id = '" + DropDownList1.SelectedValue + "' ";
DataTable dt = Maticsoft.DBUtility.DbHelperSQL.Query(sql).Tables[0];
aspnetpage1.RecordCount = dt.Rows.Count;
PagedDataSource pds = new PagedDataSource();
pds.AllowPaging = true;
pds.PageSize = aspnetpage1.PageSize;
pds.CurrentPageIndex = aspnetpage1.CurrentPageIndex - 1;
pds.DataSource = dt.DefaultView;
RpArea.DataSource = pds;
RpArea.DataBind();
}
}
在线等,谢谢 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询