views:

687

answers:

1

hi there.

im using data annotation with buddy classes for error etc however i have a field for photo on the view it should be an image but on the edit and add it should be a file upload ???

but UIHint will only let me have one, so how do you have multiple UI for one type in your class?

thanks

+2  A: 

Hi,

You should only need to specify one UIHint. Within the Views\ControllerName folder or Views\Shared you have two additional sub folders DisplayTemplates and EditorTemplates. So when you call:

<%=Html.DisplayFor(x => x.Name) %>

This will look in your DisplayTemplates folder for a control with the UIHint name which in your case will be an images, and when you call:

<%=Html.EditorFor(x => x.Name) %>

This will look in your EditorTemplates folder for a control with the UIHint name which will be a file uploader.

Here's an basic editor example that should help you: example.

Simon G
yep excelent thanks very much this is what i was after
minus4