Mam widok, aby wyświetlić poniższy obiekt klienta."Model" jest w konflikcie z deklaracją "System.Web.Mvc.WebViewPage <TModel> .Model
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; }
}
i mającą kontroler do zwrotu Klientowi Zobacz
public ActionResult GetCustomer(long Id)
{
return View("Customer",GetCustomer(Id));
}
I wreszcie widok jest,
[Customer.cshtml]
@model Customer;
Name: @Model.Name
Address Details: @Html.Partial("Address",Model)
[Address.cshtml]
@model Customer;
@Model.CityInfo.Name, @Model.RegionInfo.Name
Wszystko wydaje się w porządku. Ale pojawia się konflikt "Model" z deklaracją błędu "System.Web.Mvc.WebViewPage.Model" na @Html.Partial ("Adres", Model) Zrobiłem to samo wcześniej w wielu projektach i nie otrzymałem problem.
Nie mam pojęcia o dalszych krokach.
Czy ktoś mógłby mi pomóc rozwiązać ten problem?
Widziałem wiele postów dotyczących tego rodzaju błędu. Ale nie były one z @ Html.Partial().
Dzięki & Pozdrowienia,
Saravanakumar R.
Po prostu miałem ten sam problem, każdy pomysł DLACZEGO jest to problem ... Zmiana stolic naprawiła to dla mnie, ale chciałbym wiedzieć dlaczego. – Waller
Model jest własnością IView. gdzie model jest odniesieniem do danych (model), które wracamy z działania kontrolera. :-) – Sravan