A: 

I am not completely sure but give it a shot.

In your partial view

<% bool outputValidation = this.ViewContext.Controller.ViewData.Model.GetType() == typeof(Contact) %>

<div class="editor">   
    <%: Html.HiddenFor(model => model.AddressID) %>
    <%: Html.HiddenFor(model => model.AddressID) %>
    <div class="editor-label">
        <%: Html.LabelFor(model => model.CivicNumber) %>
    </div>

    <div class="editor-field">
        <%: Html.TextBoxFor(model => model.CivicNumber)%>
        <%: outputValidation ? Html.ValidationMessageFor(model => model.CivicNumber) : "" %>
    </div>
</div>

What you are doing is getting the Model of the parent view. Then just check it's type.

jcruz

related questions