KD
Krishnaraj D
Syncfusion Team
July 28, 2010 09:00 AM UTC
Hi Rick,
Your Incident has been updated. Please check it.
Regards,
Krishnaraj D
KD
Krishnaraj D
Syncfusion Team
July 30, 2010 12:14 PM UTC
Hi Rick,
While enabling paging/sorting/filtering/editing functionalities, you have to rebind the QuerycellInfo property again in post action since Essential Grid is fully ajax enabled. So for paging/sorting/filtering/editing actions the entire page will not be refreshed, the grid contents alone refreshing using ajax calls.
So the below methods is necessary to achieve the grid actions.
Please refer the below code snippets.
Controller:
If you enabled the paging/sorting/filtering/editing features, rebind the QueryCellInfo property again in post action as below.
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(PagingParams args)
{
IEnumerable data = new NorthwindDataContext().Orders.Take(200);
ActionResult result = data.GridActions();
var grid_Data = result as GridHtmlActionResult;
//rebinding the custom QueryCellInfo
grid_Data.GridModel.QueryCellInfo = this.QueryCellInfo;
return grid_Data;
}
//Custom QuerycellInfo
[ChildActionOnly]
public void QueryCellInfo(GridTableCell cell)
{
if (cell.TableCellType == GridTableCellType.RecordFieldCell || cell.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
if (cell.Column.MappingName == "CustomerID")
{
if (cell.Data.Freight <= 30)
cell.HtmlAttributes["style"] = "color:Blue;background-color:Chocolate;";
}
}
}
If you feel inconvenient in redefining the custom QueryCellInfo in controller, then use the Html.RenderAction method in View to access the custom QueryCellInfo action in controller.
Refer the below code snippets.
.QueryCellInfo(currentCell => Html.RenderAction("QueryCellInfo", "Home", new { cell = currentCell }))
But we suggest that to use the first method as it’s not a fair programming strategy to go back to controller from view.
Regards,
Krishnaraj D