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

[Solved] Any way to force grid to use \Views\Shared\DisplayTemplates\Object.ascx as start point for rendering cells?

1 Answer 25 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.
Andrej
Top achievements
Rank 1
Andrej asked on 12 Sep 2011, 05:07 PM
Hello fellows Telerikers,
I would like to render each cell (no matter which type it is) in Grid with additional info.
I thought natural way to be to add this logic to ~\Views\Shared\DisplayTemplates\Object.ascx
I tried it, and seems that grid is not using Object.ascx for rendering Display views (but it does use other templates from DisplayTemplates).
Is there any way I could specify that grid should use Object.ascx?
Or maybe i could create similar file (lets say GridObject.cshtml), that would be start point for rendering all cells.

p.s. I'm using server side binding.

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 13 Sep 2011, 12:53 PM
Hello Andrej,

The Grid component performs Html.DisplayFor for each column field. This will show (if any) the display template for real type of the field. To show the Object.ascx template you will have to perform Html.DisplayForModel.

You can control the display template per field by using UIHint attribute as described on the link bellow.
http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-display-and-editor-templates.html#DisplayTemplates

Greetings,
Rusev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Andrej
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or