Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Model' conflicts with the declaration 'System.Web.Mvc.WebViewPage<TModel>.Model

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.

like image 829
Sravan Avatar asked Jun 01 '13 14:06

Sravan


1 Answers

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.

like image 170
Sravan Avatar answered Sep 25 '22 22:09

Sravan