Hello,
I've been trying to get paging working with a query and the pagesize is working however the page isn't; it's always page one.
I'm using LLBLGen 1.0.2005.1 Final (July 6th 2006)
Any ideas?
Thanks, Mike
TypedListDAO dao = new TypedListDAO();
int pageSize = int.Parse(ConfigurationSettings.AppSettings["searchListPageSize"]);
if(ViewState["Pages"]==null)
{
int totalOrders = dao.GetDbCount(fields, null, where, rels, groupByClause);
ViewState["TotalOrders"] = totalOrders;
int pageCount = Convert.ToInt32(Math.Ceiling(((double)totalOrders/(double)pageSize)));
DataTable pages = new DataTable();
pages.Columns.Add(new DataColumn("PageNumber", typeof(int)));
for(int i=1; i<=pageCount; i++)
{
DataRow newRow = pages.NewRow();
newRow["PageNumber"] = i;
pages.Rows.Add(newRow);
}
ViewState["Pages"] = pages;
}
rptPages.DataSource = (DataTable)ViewState["Pages"];
rptPages.DataBind();
numberOfResults = ((int)ViewState["TotalOrders"]).ToString() + " results found";
if(ViewState["CurrentPage"]!=null)
{
currentPage = (int)ViewState["CurrentPage"];
}
DataTable tl = new DataTable();
dao.GetMultiAsDataTable(fields, tl, 0, sorter, where, rels, true, groupByClause, null, currentPage, pageSize);