I am trying to filter results based on user price range selection . so I choose the jquery slider for showing range of price. and I have decided to call web method using jquery ajax
on slider stop event
.
everything is fine at this stage .here is code for my web method which filter the records basis on min and max range passed by jquery ajax
call
[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();
}
Now problem is with Paging
method which is used to set the datasource
of repeater control . Paging method as follow:
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();
}
when this method is called its through error that object reference not set . I understand that this time page controls can not be accessed. as I read some answers which are deny completely this issue regarding access page control
Now I want to know what approach should I use to complete my task which is
use jquery price slider to filter the records?