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

razor syntax for template columns

6 Answers 310 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.
Tim
Top achievements
Rank 1
Tim asked on 25 Nov 2010, 04:43 PM
Hi,

i'm trying to get template columns working in my telerik grid.
The razor-engine doesn't recognize the @Html.ActionLink blog but the grid shows the template column titles. the problem is, that it doesn't fill the row entries. There are no links to click to get to a detail view or an edit view.

Here is my code:

@(Html.Telerik().Grid(Model).Name("Grid")
        .DataKeys(dataKeys => dataKeys.Add(c => c.Auftrag_GUID))
        .Columns(columns =>
        {
            columns.Template(o =>
            {
                @Html.ActionLink("Details", "Details", new { id = o.Auftrag_GUID });
            }).Title("Details").Width(55);
            columns.Template(o =>
            {
                @Html.ActionLink("Edit", "Edit", new { id = o.Auftrag_GUID });
            }).Title("Edit").Width(40);           
            columns.Bound(o => o.Titel);
            columns.Bound(o => o.AuftragStatus).Title("Status");
        })
        .Resizable(resizing => resizing.Columns(true))
        .Scrollable()
        .Pageable(pager => pager.PageSize(10))
        .Filterable()
        .Groupable()
        .PrefixUrlParameters(false)
)

Regards,
Tim

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 25 Nov 2010, 05:04 PM
Hello Tim,

 A customer of ours ported most of the demos to Razor. You can check the server templates demo here. Check the corresponding view in the codeviewer.

 We plan to officially release Razor demos soon so stay tuned.
Regards,

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
Tim
Top achievements
Rank 1
answered on 29 Nov 2010, 09:35 AM
Thanks for this URL. That helps alot.

It's really bad that we are forced to use html markup to get working template columns.

Will Telerik components with razor engine be working like components with aspx engine?

I'm not using MVC to write any html code by hand :-)

Regards,
Tim
0
Tim
Top achievements
Rank 1
answered on 29 Nov 2010, 10:54 AM
Unfortunately there is no example for <div> Tags.

@(Html.Telerik().TabStrip()
            .Name("TabStrip")
            .Items(tabstrip =>
            {
                tabstrip.Add()
                    .Text("Page1")
                    .ImageUrl("~/Content/Icons/sl.png")
                    .Content(@<div class="display-label">Guid</div>
                            <div class="display-field">Model.Guid </div>
                            );
                 
            })
            .SelectedIndex(0)
            );



Compiler error message: CS1513: } expected.

Regards,
Tim
0
Tim
Top achievements
Rank 1
answered on 29 Nov 2010, 11:43 AM
Wrapping one <div>-container arround many <div>-Tags will fix my problem.
0
Jakub
Top achievements
Rank 1
answered on 10 Jan 2011, 06:51 PM
http://mvcdemo.chiplex.com/grid/templatesserverside - link doesn't work
0
T. Tsonev
Telerik team
answered on 11 Jan 2011, 08:37 AM
Hi Tim,

The Service Pack release that we plan to release next week will include Razor versions of all demos, as well as updated guidelines on how to convert between WebForms and Razor syntax.

Thank you for your patience.

Best regards,
Tsvetomir Tsonev
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
Tags
Grid
Asked by
Tim
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Tim
Top achievements
Rank 1
Jakub
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or