Problems with Grid

I can't get the sorting to work.

I'm just trying to follow your example but using my own database. I get the grid displayed OK (although NOT the DateTime columns) but I can't get the sorting to work. I have a controller that inherits from System.Web.Mvc controller with th following
public ActionResult Grid()

{
ViewData["GridModel"] = new MvcGridModel()

{
DataSource = context.flypros.Skip(0).Take(2).ToList(),
SkinName = "Syncfusion-Grid-Office2007Black",
ActionMode = "Server",
AllowDragAndDrop = true,
AllowGrouping = false,
ServerModePagingSortingMapper = "ServerModeSortingAction",
AllowResizing = true,
AllowSelection = true,
AllowEditing = false,
AllowPaging = false,
ShowCaption = true,
CaptionText = "Flypros",
AllowSorting = true,
HeaderText = { "Flypro ID", "Name", "Comments", "StatusID"},
PrimaryKeyColumns = { "Flypro ID" }
};

return View();
}

//On Sorting Action
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ServerModeSortingAction()
{
IEnumerable data = context.flypros.Skip(0).Take(2).ToList();
return data.MvcGridActions();
}
}

and here is the view:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>


Grid




Grid


<%Html.Grid(

"mvcgridservermode", "GridModel", column =>{

column.Add(p => p.id);

column.Add(p => p.name);

column.Add(p => p.comments);

column.Add(p => p.status_id);

column.Add(p => p.source_ato);


}); %>





Please can you suggest why my "ServerModeSortingAction" method is not being called?

Wendy





Grid_864345d2.aspx

1 Reply

AD Administrator Syncfusion Team June 5, 2009 05:25 PM UTC

Hi Wendy,

Thanks for your interest in Syncfusion products.

The code attached seems to be correct with a small change.The value of ServerModePagingSortingMapper property should be controller name and followed by action method name.

Example:

Controller Name: Home
Sort Action method name: ServerModeSortingAction

The ServerModePagingSortingMapper should be as follows :

[C#]
ViewData["GridModel"] = new MvcGridModel()
{
//Other properties to be added.

ServerModePagingSortingMapper = "Home/ServerModeSortingAction"

}

Please let us know if this helps.

Regards,
Muthukumar.

Loader.
Up arrow icon