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

[Solved] Non Aggregate Model Values in an Aggregate Template Header?

0 Answers 10 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Heath
Top achievements
Rank 1
Heath asked on 08 Nov 2011, 05:17 PM

My grid:

    @( Html.Telerik().Grid<eGate.BackOffice.Core.Model.UI.EgateMenuRevisionViewData>()
        .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(c => c.ParentId)
            .Aggregate(a => a.Count()).ClientGroupHeaderTemplate(Html.ActionLink("Create a Revision for This Menu", "Edit", "Thing", new { menuid = "<#= Key #>" }, null).ToString());
        columns.Bound(c => c.ParentName);
        columns.Bound(c => c.ThingName);

    })

    .Groupable(grouping => grouping.Groups(groups => { 
        groups.Add(c => c.EgateMenu.EgateMenuId);
    }).Visible(false))

This works. But it gives me:

Create a revision for this menu
1 Parent 1 Thing 1.1
1 Parent 1 Thing 1.2
1 Parent 1 Thing 1.3
Create a revision for this menu
2 Parent 2 Thing 2.1
2 Parent 2 Thing 2.2
2 Parent 2 Thing 2.3

And while that works, I'd much rather something more intuitive like:

Create a thing for parent 1
Thing 1.1
Thing 1.2
Thing 1.3
Create a thing for parent 2
Thing 2.1
Thing 2.2
Thing 2.3

Problem 1: Create a thing for... needs to pass the ParentId to the actionlink but it needs to display the ParentName for the client yet only one exists in the aggregate at a time.

Problem 2: I want to group by the Id without displaying the Id column in the results. But setting the column to visible(false) supresses the clientgroupheadertemplate.

Tags
Grid
Asked by
Heath
Top achievements
Rank 1
Share this question
or