1
我在.cshtml中有這段代碼。使用MVC3 @使用顯示控件
@using (Html.BeginRouteForm("CheckoutShippingAddress", FormMethod.Post))
{
<div class="enter-address-body">
@{
var dataDictPatient = new ViewDataDictionary();
dataDictPatient.ModelState.Merge(ViewData.ModelState);
dataDictPatient.TemplateInfo.HtmlFieldPrefix = "PatientInformation";
@Html.Partial("_CreateOrUpdateAddress", Model.PatientRoom, dataDictAddress)
}
正在發生的事情是錯誤的
The model item passed into the dictionary is of type 'Models.Common.PatientModel', but this dictionary requires a model item of type 'Models.Common.AddressModel'.
什麼,我不知道是我改變了字典想patientmodel而不是addressmodel。
您發佈的代碼與錯誤沒有任何關係,錯誤是由頁面頂部的@model語句導致的 –
同意,您在那裏工作正常 - 但您需要更改模型聲明 – Cody
您能否顯示您的操作方法和模型? – shuniar