Sorting /paging grid with params in action ?

I made a view with grid control and it works fine with sorting and paging but only when action in controller that provides data to the grid has no parameters. When it has one parameter, sorting and paging operations go to the same method instead of sorting/paging action. Could anyone provide such an example. Perhaps the routing must be changed?

1 Reply

BM Balaji M Syncfusion Team October 27, 2009 07:48 PM UTC

Hi lukasz,

Thank you for your interst in Syncfusion products.

I have created a simple sample to this issue and in this sample Grid Paging/Sorting functions works when the

paging/sorting action has one parameter.

Please refer the following code snippet to achieve this.
public ActionResult Index()
{
GridPropertiesModel model = new GridPropertiesModel
{
DataSource =new NorthwindDBDataContext().Products.ToList(),
AutoFormat = Syncfusion.Mvc.Shared.Skins.Office2007Silver,
AllowSorting=true,
AllowPaging=true,
PageCount=5,
PageSize=10,
PagingSortingMapper="PagingAction",
Caption = "Product List"
};

ViewData["GridModel"] = model;
return View();
}

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult PagingAction(PagingParams args)
{
IEnumerable data = new NorthwindDBDataContext().Products.ToList();
return data.GridActions();
}


Please refer the sample from the below link.
http://files.syncfusion.com/support/grid_mvc/presale/P511/Mvc_SampleGrid.zip.

Please let me know if you have any concerns.

Regards,
M. Balaji.



Loader.
Up arrow icon