我正在尝试根据用户价格范围选择过滤结果。所以我选择 jquery 滑块来显示价格范围。我决定ajax
在滑块上使用 jquery 调用 web 方法stop event
。
ajax
在这个阶段一切都很好。这是我的 web 方法的代码,它根据 jquery调用传递的最小和最大范围过滤记录
[WebMethod]
public static void FilterByPrice(double min,double max)
{
List<BALHotelList> searchresult =(List<BALHotelList>) HttpContext.Current.Session["searchresult"];
searchresult = searchresult.Where(t => (double)t.totalPrice >= min && (double)t.totalPrice <= max).ToList();
HttpContext.Current.Session["searchresult"] = searchresult;
SearchResult s = new SearchResult();
s.Paging();
}
现在的问题是Paging
用于设置datasource
中继器控制的方法。分页方式如下:
protected void Paging()
{
List<BALHotelList> searchresult = (List<BALHotelList>)Session["searchresult"];
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = searchresult;
objPds.AllowPaging = true;
objPds.PageSize = Convert.ToInt32(ddlPageNo.SelectedValue);
objPds.CurrentPageIndex = CurrentPage;
lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString() + " of "
+ objPds.PageCount.ToString();
// Disable Prev or Next buttons if necessary
cmdPrev.Enabled = !objPds.IsFirstPage;
cmdNext.Enabled = !objPds.IsLastPage;
rptHotels.DataSource = objPds;
rptHotels.DataBind();
}
当通过错误调用此方法时,未设置对象引用。我了解此时页面控件无法访问。当我阅读一些完全否认有关访问页面控制的问题的答案时
现在我想知道我应该使用什么方法来完成我的任务
使用 jquery 价格滑块过滤记录?