Oct 09, 2009, 9:40 AM
Grid Paging failed in Fire Fox & Chrome
Hi,
I tried to use the Grid Paging & Sorting example with my own implementation and it passed in IE but failed in Fire Fox & Google Chrome. The problem is Grid doesn't show any data.
I used the following entity class to retrieve the data from Server and used during the paging process also.
I tried to use the Grid Paging & Sorting example with my own implementation and it passed in IE but failed in Fire Fox & Google Chrome. The problem is Grid doesn't show any data.
I used the following entity class to retrieve the data from Server and used during the paging process also.
public class COAClass
{
public static List<Acc_ChartOfAccountsResult> GetAll()
{
RASberryDBDataContext db = new RASberryDBDataContext();
return db.Acc_ChartOfAccounts(Convert.ToInt32(HttpContext.Current.Session["BranchId"].ToString()), "ALL").Select(e=>e).ToList();
}
public static List<Acc_ChartOfAccountsResult> GetCOA(string AccType,int start, int limit, string sort, string dir, out int count)
{
RASberryDBDataContext db = new RASberryDBDataContext();
//IQueryable<Acc_ChartOfAccountsResult> result=null;
var q = db.Acc_ChartOfAccounts(Convert.ToInt32(HttpContext.Current.Session["BranchId"].ToString()), AccType).Select(e=> e);
List<Acc_ChartOfAccountsResult> qList = q.ToList();
int reccount = qList.Count();
if (!string.IsNullOrEmpty(sort))
{
//To use it with IEnumerable Or IQueriable interface (this can't be used for Order by expression for Generic List interface)
//var param = Expression.Parameter(typeof(Acc_ChartOfAccountsResult), "e");
//var sortExpression = Expression.Lambda<Func<Acc_ChartOfAccountsResult, object>>(Expression.Property(param, sort), param);
PropertyInfo prop = typeof(Acc_ChartOfAccountsResult).GetProperty(sort);
if (dir == "DESC")
{
//result = result.OrderByDescending(sortExpression);
qList.OrderByDescending(x => prop.GetValue(x, null));
}
else
{
qList.OrderBy(x => prop.GetValue(x, null));
//result = result.OrderBy(sortExpression);
}
}
count = reccount;
if (start >= 0 && limit > 0)
{
return qList.Skip(start).Take(limit).ToList();
}
else
{
return qList.ToList();
}
}
}