0

this is my object

public class ProductContent
    {
        public Product Product { get; set; }
        public Location ProductLocation { get; set; }


    }

I have a view that is tightly coupled with Location object.

i have a view that is tightly coupled with ProductContent in my productcontent view i do

@Html.Partial("../PartialViews/Location", Model.ProductLocation)

i get a error saying

The model item passed into the dictionary is of type 'ProductContent', but this dictionary requires a model item of type 'Location'.

I am passing Model.ProductLocation which is of type location but why does it still error off?

I am using MVC3 C# Razor

tereško
  • 58,060
  • 25
  • 98
  • 150
Natasha Thapa
  • 979
  • 4
  • 20
  • 41

1 Answers1

1

This is a feature of asp.net mvc's RenderPartial. When you pass null as a model, it uses the model of parent view.

ASP.NET MVC, strongly typed views, partial view parameters glitch

Community
  • 1
  • 1
driushkin
  • 3,531
  • 1
  • 24
  • 25