I have been given the task of creating a template for Views in MVC. Basically, instead of many Views (CRUD) for each entity, we would only have one that accepts generic model and displays it in Edit/Display mode.
I have so far played around with IView, WebViewPage and ViewPage, but I can't seem to get anything to work. I also searched for something like this, but can't find anything useful really.
Specifically, I don't know which C# class I could overwrite/implement to get my desired effect. Can anybody help me out here?
When using MVC you normally have Razor Views (.cshtml). These come in 4 flavours:
From your question, I think, you want EditorTemplates.
Create a new View in Views/Shared/EditorTemplates and name it YourGenericModel.cshtml Inside this file write the first line:
You can now specify what should be rendered using the normal Razor syntax.
To Have your model displayed using your new View simply call