3

I have the following markup in a 'content' page. Without the Render call, nothing renders, and with the Render call, the grid renders as the first element in the whole page, not inside the 'content' section defined by my view:

@using Telerik.Web.Mvc.UI
@model Outdoor.Mvc.ViewModels.OutdoorSite.SiteList
@{
    Html.Telerik().Grid(Model.ItemList).Name("Site Grid")
        .Columns(columns => 
        {
            columns.Bound(o => o.SiteId);         
            columns.Bound(o => o.Name);
        })
        .Pageable()
        .Sortable()
        .Render();
}

What am I doing wrong?

1 Answer 1

5

This is because of different approach to rendering Razor's views. In order to make it work you have to remove Render() call and build grid in multiline expression block, like this:

@using Telerik.Web.Mvc.UI
@model Outdoor.Mvc.ViewModels.OutdoorSite.SiteList
@(
    Html.Telerik().Grid(Model.ItemList).Name("Site Grid")
        .Columns(columns => 
        {
            columns.Bound(o => o.SiteId);         
            columns.Bound(o => o.Name);
        })
        .Pageable()
        .Sortable()
)
Sign up to request clarification or add additional context in comments.

1 Comment

Yep, figured that one out last night off the Telerik examples. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.