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

How to show "View" in Kendo Grid?

5 Answers 40 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Esref Atak
Top achievements
Rank 1
Esref Atak asked on 27 Jan 2014, 02:40 PM
Hi,

I have Kendo grid and I want to show a view in it as you see attachment.

But I could not do it? Can you send me a sample project about it?

5 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 29 Jan 2014, 09:13 AM
Hi Esref,

The most obvious options are:

+ use an iframe in each row via a column template 
+ load a partial view in each row with a Javascript function (expression) included in a column template

http://docs.telerik.com/kendo-ui/api/web/grid#configuration-columns.template

http://docs.telerik.com/kendo-ui/getting-started/framework/templates/overview#template-syntax

http://demos.telerik.com/kendo-ui/web/templates/expressions.html

Both of these techniques, however, will be bad for the performance and I would not recommend them lightheartedly. Please consider loading the views' content in advance and passing it directly via the Grid dataSource.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Esref Atak
Top achievements
Rank 1
answered on 30 Jan 2014, 09:21 AM
Hi Dimo,

Can I write Html.RenderAction() method into your template solution?
0
Dimo
Telerik team
answered on 30 Jan 2014, 10:13 AM
Hello Esref,

Yes,  you can, but you need to use server-side data binding and configure the Grid as follows:

@{ Html.Kendo().Grid(Model)
    // ...
    .Render();
}


Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Esref Atak
Top achievements
Rank 1
answered on 30 Jan 2014, 01:57 PM
I actually ask how can I use Html.RenderAction() method in a column of a Kendo UI Grid.
You can see what I want to say in attaced file in my first post.

Thank you
0
Dimo
Telerik team
answered on 31 Jan 2014, 04:47 PM
Hi Esref,

As I already mentioned, the desired result requires using column templates. RenderAction requires a server-side template, that's why you must also use server-side binding, as I explained.

http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/faq#how-do-i-customize-the-way-a-property-is-displayed-in-a-grid-bound-column?


@{Html.Kendo().Grid(Model)
    .Columns(columns =>
    {
        columns.Bound(c => c.FieldName).Template(@<text>
            @{ Html.RenderAction("name"); }
        </text>);
        columns.Template(@<text>
            @{ Html.RenderAction("name"); }
        </text>).Title("template column");
    })
    .Render();
}


Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
Esref Atak
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Esref Atak
Top achievements
Rank 1
Share this question
or