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

[Solved] IGrouping with a Panel Bar

1 Answer 20 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Clay
Top achievements
Rank 1
Clay asked on 25 Mar 2011, 05:40 PM
Greetings!

I am trying to use a GroupBy'd lambda expression with a Panel Bar... the desired effect being that the "Groups" and the Panel Bar names.  For example:

 

 

 

List<Product

>(product.Objects).GroupBy(p => p.Category.Name);

I have the Panel Bar headers reading properly with:

 

 

@(Html.Telerik().PanelBar()

    .Name(

 

"PanelBar")

 

 

    .BindTo(Model, mappings =>

    {

        mappings.For<

 

IGrouping<string, Product >>(binding => binding

 

 

            .ItemDataBound((parent, grouping) =>

            {

                parent.Text = grouping.Key;

            })

        );

 

    }

)
)

But I cannot get the children to populate correctly
<THE BELOW DOES NOT WORK - COMPILER ERROR>

 

@(Html.Telerik().PanelBar()

    .Name("PanelBar")

 

    .BindTo(Model, mappings =>

    {

        mappings.For<

 

IGrouping<string, Product>>(binding => binding

 

 

            .ItemDataBound((parent, grouping) =>

            {

                parent.Text = grouping.Key;

            })

            .Children(grouping => grouping.Select(g => g)));

        mappings.For<

 

Product>(binding => binding

 

 

            .ItemDataBound((child, product)

            {

                child.Text = product.Name;

            }));

    }

)
)

Any help would be very much appreciated.

Thanks in advance!

- Clay Ver Valen

 

 

 

1 Answer, 1 is accepted

Sort by
0
Clay
Top achievements
Rank 1
answered on 25 Mar 2011, 06:12 PM
Never mind.  Dumb error in my Child LINQ lambda was causing the compiler error.
Tags
PanelBar
Asked by
Clay
Top achievements
Rank 1
Answers by
Clay
Top achievements
Rank 1
Share this question
or