This is a migrated thread and some comments may be shown as answers.

How to save Aggregations/Cells attributes when rebind (Client-side)?

1 Answer 14 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexandre
Top achievements
Rank 1
Alexandre asked on 23 Sep 2013, 01:14 PM
Hello,

I work on a Grid and use .Aggregate() and .CellAction() (for cell.HtmlAttributes["style"]). 

Everything works except when I rebind the grid on the client-side (after edit, delete, etc.). I lost my aggregations and all my cells style too. How can I keep this parameters during a rebind ?

Here is my grid :
   
@{
Html.Telerik().Grid(Model)
           .Name("Grid")
           .DataBinding(dataBinding =>
           {
               dataBinding.Ajax()
                   .Select("Select", "MyController")
                   .Insert("Insert", "MyController")
                   .Update("Update", "MyController")
                   .Delete("Delete", "MyController");
           })
           .ClientEvents(events => events
               .OnDataBinding("onDataBinding")
               .OnComplete("onComplete")
               .OnEdit("onEdit")
               .OnRowDataBound("onRowDataBound"))
           .Columns(columns =>
           {
               columns.Command(commands =>
               {
                   commands.Edit().ButtonType(GridButtonType.Image);
                   commands.Delete().ButtonType(GridButtonType.Image);
               }).Width(30); ;
               columns.Bound(o => o.Id);
               columns.Bound(o => o.col1);
                   .Aggregate(aggregates => aggregates.Sum())
                   .GroupFooterTemplate(@<text>@item.Sum</text>);
               columns.Bound(o => o.col2)
                   .Aggregate(aggregates => aggregates.Sum())
                   .GroupFooterTemplate(@<text>@item.Sum</text>);
               columns.Bound(o => o.col3)
                   .Aggregate(aggregates => aggregates.Sum())
                   .GroupFooterTemplate(@<text>@item.Sum</text>);
               
           })
           .CellAction(cell =>
           {
               if ((cell.Column.Member == "col1")
               {
                   cell.HtmlAttributes["style"] = "background-color: red";
               }
           })
           .Sortable(sorting => sorting
               .SortMode(GridSortMode.MultipleColumn)
           )
           .Filterable()
           .Render();
   }
}

Thank in advance for your help,

Alexandre G.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 26 Sep 2013, 10:19 AM
Hi Alexandre,

I am afraid RadGrid for ASP.NET AJAX does not support complex operations with MVC.
You can check out Kendo UI:
http://www.kendoui.com/server-wrappers/mvc.aspx

Hope this helps.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Alexandre
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or