Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add and use a razor editor template

I have tried to find documentation or samples on how to incorporate razor editor templates into a project. the following answer on another thread may fix a problem I am having but I do not know how to incorporate it into my project. It is no doubt easy.

here is the solution I do not know how to incorporate: Client-side validation of input type date does not work

like image 416
James Kenny Avatar asked Feb 08 '13 10:02

James Kenny


1 Answers

Here is short info about adding EditorTemplate. In short words - you have to create directory EditorTemplates in Views/Shared and you should create a view with the same name as the model you want to create the editor for.

Remember that EditorTemplate for a model is used when calling Html.EditorFor with object of this model as argument. You should use them to provide editing possibilities, of course - if you want to create something that should only display data, use the same way to create DisplayTemplate (create DisplayTemplates directory). DisplayTemplate is rendered on Html.DisplayFor call with object of this model as argument.

like image 171
Konrad Gadzina Avatar answered Sep 22 '22 00:09

Konrad Gadzina