Reputation: 53
MVC4, razor views. I can open a detail window for a Kendo (Ajax) grid item using a client template and that works. My problem is that I lose my grid state (sorting/ordering,etc) when I return to the grid.
My thought was to use a popup window to display the grid item detail. I see how to create a popup edit window, but I only want to display the details without edit capabilities.
I can't seem to create a custom command since I'm using Ajax datasource.
Any ideas on how I can accomplish opening a detail window and not lose my grid state, or popup a details window only, (using razor syntax please).
Thanks
Upvotes: 4
Views: 3426
Reputation: 8275
A trick is to use an editor template. If you have setup your grid as bound on the type MyType
:
@(Html.Kendo().Grid<MyType>().Name("my-grid"))
you then just have to add in the same view folder a new folder named EditorTemplates
(if you always don't have one, normally you have one such folder under the Shared
folder used for the Kendo templates) and put into it the view that you want to display in your popup :
@model MyType
<div class="display-label">@Html.LabelFor(m => m.Name)</div>
<div class="display-field">@Html.DisplayFor(m => m.Name)</div>
and so on...
Upvotes: 0