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

[Solved] Define footer template with Razor

3 Answers 234 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.
Roland
Top achievements
Rank 1
Roland asked on 11 Feb 2011, 03:46 PM
The sample page shows non-razor code for the razor example and I can't get it to work.

How do I define a Footer template with Razor?

I do the following:

            columns.Bound(weekRecord => weekRecord.FirstDayOfWeek.Hours)
                .Title(ViewBag.FirstDayTitle)
                .FooterTemplate(() => @<b>Blah</b>); Compiler Error Message: CS1977: Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type
I'm using Ajax databinding and the latest version.

Thanks!

3 Answers, 1 is accepted

Sort by
0
Roland
Top achievements
Rank 1
answered on 15 Feb 2011, 09:34 AM
I'm still struggling. A code sample would be great.

thanks,

Roland
0
Atanas Korchev
Telerik team
answered on 15 Feb 2011, 10:18 AM
Hi Roland,

 All Telerik online demos have a Razor counterpart. You can check the header and footer template demo and inspect the code in the "View" tab.

All the best,

Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
tom
Top achievements
Rank 1
answered on 24 Feb 2011, 04:38 PM
Atanas the razor online demo code is confusing. The description tab (default) shows aspx code but the view does indeed show the Razor code.

Roland, you need to use the razor command @<text>. something like 

@{  Html.Telerik().Grid(Model.Products)
            .Name("Grid")
            .Columns(columns =>
            {                           
                columns.Bound(p => p.UnitPrice)
                    .FooterTemplate(
                        @<text>
                            Total:@string.Format("{0:c}", Model.TotalPrice)
                        </text>
                    )
                    .Width(100)
                    .Format("{0:c}");
            })
            .Pageable()
            .Render();
    }

Tags
Grid
Asked by
Roland
Top achievements
Rank 1
Answers by
Roland
Top achievements
Rank 1
Atanas Korchev
Telerik team
tom
Top achievements
Rank 1
Share this question
or