views:

777

answers:

1

Hi,

You can provide alternate templates for individual types, but is it possible to override the template that wraps the label, field and validation up.

Change:

<div class="editor-label"><label for="Content">Content</label></div>
<div class="editor-field"><input class="text-box single-line" id="Content" name="Content" type="text" value="" /> </div>

To:

<div class="field">
<label for="Content">Content</label>
<input class="text-box single-line" id="Content" name="Content" type="text" value="" /> </div>

Rich

+4  A: 

You can write an Object.ascx template and perform your own logic.

Haacked
Thanks for the response. This just overrides the base type. What I'm looking is a why to override the template that contains the label, field and validation template. If that is possible.
kim3er
It's the Object template that does that. It iterates through each property of an object and renders those three things. Check out Brad Wilson's series on the topic http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-1-introduction.html
Haacked
Beg your pardon. Found the Brad Wilson blog under my own steam. Initially I had been expecting to find a single item template, rather than an iterator template and as a result didn't understand what I was seeing in your example. Thanks again.
kim3er