When I am developing a basic Employee application of CRUD Operations using jQuery dialog and Entity Framework, I am getting two type of error when I am debugging and when I am building the solution, I know they both linked to each other but I am not able to figure out
Error 1 when building:
The type arguments for method 'System.Linq.Enumerable.OrderBy(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly
This the code(in Model class):
public IEnumerable<tblEmployee> GetEmployeePage(int pageNumber, int pageSize, string searchCriteria)
{
if (pageNumber < 1)
pageNumber = 1;
return testEmp.tblEmployees
.OrderBy(searchCriteria) //I am getting error here//
.Skip((pageNumber - 1) * pageSize)
.Take(pageSize)
.ToList();
}
Error 2 when debugging:
System.ArgumentNullException: Value cannot be null.
The code as below (in View):
@model Emp_Mvc_Application.Models.PagedEmployeeModel
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
WebGrid grid = new WebGrid(rowsPerPage: Model.PageSize);
grid.Bind(Model.TblEmp, autoSortAndPage: false, rowCount: Model.TotalRows);
}