I get the following exception on call Html.RenderPartial:
The model element passed to the dictionary is of the "ChildClass" type, but this dictionary requires a model element of the "ParentClass" type.
These two classes are related to this:
public class ChildClass { }
public class ParentClass
{
public ChildClass ChildProperty { get; set; }
}
I have an instance ParentClasswhere the value ChildPropertyis equal null.
I have two partial views, ParentView( ViewUserControl<ParentClass>) and ChildView( ViewUserControl<ChildClass>).
In the first view, I have the following ...
<% Html.RenderPartial("~/Views/Controls/ChildView.ascx", Model.ChildProperty); %>
This is the line that throws the exception indicated at the top of this message.
, ChildProperty . MVC , ?
, , ChildView, ChildProperty , .