Euston
Euston

Reputation: 81

ASP NET mvc 2 Template for EditorFor and DisplayFor

I would like to control or customise the output generated by DisplayFor and EditorFor so it doesn't render the default html css tags for example: .......

I would like this to be for all views not just a type or system type? And what is the simplest solution?

Any help would be appreciated.

Upvotes: 0

Views: 784

Answers (1)

Faizan S.
Faizan S.

Reputation: 8644

You can always create a custom DisplayFor/EditorFor *.asxc file that resides in either Shared/DisplayTemplates or -/EditorTemplates, pass the relevant type to it and just render what you want.

Following article explains it in further details:

(This introduces the DisplayFor method - EditorFor works exactly the same way)

Upvotes: 3

Related Questions