hello all,
i want to use jqgrid in my simple Asp.net application
now the problem when i am writing this code.
public void GetGridData(string sidx, string sord, int page, int rows)
{
return Content(JsonHelper.JsonForJqgrid(GetDataTable(sidx, sord, page, rows), rows, GetTotalCount(), page), "application/json");
}
public int GetTotalCount()
{
int totalCount = 0;
try
{
using (GuestPassEntities demoMvcEntities1 = new GuestPassEntities())
{
totalCount = (from _product in demoMvcEntities1.GP_Register
select _product).Count();
}
}
catch
{
}
return totalCount;
}
public DataTable GetDataTable(string sidx, string sord, int page, int pageSize)
{
List<GP_Register> AllProducts = null;
DataTable tab1 = new DataTable();
using (GuestPassEntities demoMvcEntities1 = new GuestPassEntities())
{
AllProducts = (from _product in demoMvcEntities1.GP_Register.AsEnumerable()
select _product).ToList();
tab1.Columns.Add("title", Type.GetType("System.String"));
tab1.Columns.Add("desc", Type.GetType("System.String"));
tab1.Columns.Add("select", Type.GetType("System.String"));
foreach (GP_Register pnames in AllProducts)
{
DataRow dr = tab1.NewRow();
dr["title"] = pnames.FullName.ToString();
dr["desc"] = pnames.CompanyName.ToString();
dr["select"] = pnames.EmployeeName.ToString();
tab1.Rows.Add(dr);
}
}
return tab1;
}
how shall i return the contentresult.
Please suggest me any answers
Thanks Ritz