Has anyone come across a good solution for using ./Views/Shared/DisplayTemplates and ./Views/Shared/EditTemplates with the MvcContrib.UI Grid?
I guess I could wireup a CustomItemRenderer, but I would much rather be able to do something like:
<% Html.Grid<Person>(Model.People)
.Sort(new GridSortOptions {Column = Model.Column, Direction = Model.Direction})
.Columns(column =>
{
column.For(e=>e.Name);
column.DisplayFor(e=>e.StartDate); // <-- I'd like to do this for DateTime.asxc
}).Render();
%>
There may already be something in Grid to do this and I just haven’t found it yet. Any help would be greatly appreciated.
Thanks,
Hal
I have acheived this by modifying the source code in the GridRenderer and GridColumn classes. The change in GridColumn is to add the following function:
Then the change in GridRenderer is in the RenderItem function to be changed as follows:
Once you do this the grid will use the templates found. I have only tested with DisplayTemplates as this is all I need but it should also work for EditorTemplates with a slight change.