Hi Greg Clouston,
Please refer our online sample in the below link.
http://mvc.syncfusion.com/sfmvcsamplebrowser/8.4.0.10/Grid_MVC/Samples/4.0/databinding/CustomBinding In this sample, we are getting the altered Grid data by invoking the GetData() method in the post action. Please refer the below code snippets.
private IEnumerable GetData(PagingParams args)
{
int pagesize = args.PageSize == 0 ? 12 : Convert.ToInt32(args.PageSize);
IEnumerable data = new NorthwindDataContext().Orders.Take(200).ToList();
IQueryable ds = data.AsQueryable();
// if filterconditions exists filter the datasource using Do filtering
// extensions, which uses the expression based query generator used for apply filters
if (args.FilterDescriptors != null && args.FilterDescriptors.Count() > 0)
ds = ds.Where(args.FilterDescriptors);
//Sortcolumn, SortDirections properties are removed from Pagingparams
//New SortDescriptors property added in pagingparams. It contains list of Sort column values and their directions
if (args.SortDescriptors != null)
{
for (int i = 0; i < args.SortDescriptors.Count; i++)
{
var sortColumnName = args.SortDescriptors[i].ColumnName;
if (i == 0)
{
if (args.SortDescriptors[i].SortDirection == ListSortDirection.Ascending)
{
ds = ds.OrderBy(sortColumnName);
}
else if (args.SortDescriptors[i].SortDirection == ListSortDirection.Descending)
{
ds = ds.OrderByDescending(sortColumnName);
}
}
else
{
if (args.SortDescriptors[i].SortDirection == ListSortDirection.Ascending)
{
ds = ds.ThenBy(sortColumnName);
}
else if (args.SortDescriptors[i].SortDirection == ListSortDirection.Descending)
{
ds = ds.ThenByDescending(sortColumnName);
}
}
}
}
totalrecordCount = ds.Count();
if (totalrecordCount > 0)
data = ds.Skip(Convert.ToInt32(args.StartIndex)).Take(pagesize);
else
data = ds;
return data;
}
Please let us know if you have any further concerns.
Regards,
Krishnaraj D