I have a view to Display the below Customer Object.
public Class Customer
{
public long Id { get; set; }
public string Name { get; set; }
public Address AddressInfo { get; set; }
}
public class Address
{
public string Details { get; set; }
public City CityInfo { get; set; }
public Region RegionInfo { get; set; }
}
And Having an Controller to return the Customer to View
public ActionResult GetCustomer(long Id)
{
return View("Customer",GetCustomer(Id));
}
And finally the View Is,
[Customer.cshtml]
@model Customer;
Name: @Model.Name
Address Details: @Html.Partial("Address",Model)
[Address.cshtml]
@model Customer;
@Model.CityInfo.Name, @Model.RegionInfo.Name
All seems fine. But I am getting "'Model' conflicts with the declaration 'System.Web.Mvc.WebViewPage.Model" error on @Html.Partial("Address",Model) I had done the same before in many projects and did not got the problem.
I have no clue of further proceeding.
Could someone please help me to resolve this issue.
I have seen many posts regarding this kind of error. But those were not with the @Html.Partial().
Thanks & Regards,
Saravanakumar R.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…