HI Team,
The actual issue is as below :--
I have asp.net ejgrid having 10 pages and an external filter to select specific records. when I give values in the filter then dynamic sql is created and fresh data is extracted from database in the URL Adapter method show below. In this case, suppose only 3 records are fetched, now the values of skip and take should adjust automatically with the Data Source , but they are still comming as 40 and 10, due to which NO data is actually comming in result and error is comming.
Below is my web method, the GetUserRecords function fetches value from database from dynamic sql created as per the external filter applied, and provide data back in dataTable.
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static object GridData(int skip, int take)
{
DataTable data = GetUserRecords();
var sRec = (from DataRow row in data.Rows
select new UserTable
{
SeqNo = Convert.ToInt32(row["SeqN"].ToString()),
UserId = row["UserID"].ToString(),
Password = row["Password"].ToString(),
Priviledge = Convert.ToInt32(row["Priviledge"].ToString()),
Email = row["Email"].ToString(),
CompanyName = row["CompanyName"].ToString(),
CompanyId = Convert.ToInt32(row["CompanyId"].ToString()),
Comments = row["Comments"].ToString()
}).ToList();
var res = sRec.Skip(skip).Take(take).ToList();
return new { result = res, count = sRec.Count };
}
In above function, If I am at Page 5 of the Grid and then I apply the external Filter, It may result in a data table of 3 rows, but the Skip and Take above still have value as 40 and 10
( as I have implemented paging with 10 records only in one page)
Kindly check and revert.