I have a view to Display the below Customer Object.
public Class Customer
{
public long Id { get; set; }
public string Name { get; set; }
public
The Model
is of type Customer
rather than of type Address
in your partial. You need to change the model type in Address.cshtml
to Address
and change the call to the partial to pass in the AddressInfo
property:
@Html.Partial("Address", Model.AddressInfo)
Your view code becomes:
[Customer.cshtml]
@model Customer;
Name: @Model.Name
Address Details: @Html.Partial("Address",Model.AddressInfo)
[Address.cshtml]
@model Address;
@Model.CityInfo.Name, @Model.RegionInfo.Name
I have resolved the issue.. Thanks for the viewers.
The problem was In my View I was using somewhere Model => Model. Its should be model => model.