"임베디드 리소스"보기가 있습니다. 내가 @Html.Partial
를 사용할 때 폼이 때 CustomModel1이 (조치에 전달하기 때문에이보기에 나는이 관점에서 다음과 같은 모델"컨텐츠"보기를 "임베디드 리소스"보기의 EditorFor 템플릿으로 사용
public class TestModel
{
public TestModel()
{
CustomModel1 = new CustomModel1();
CustomModel2 = new CustomModel2();
}
public CustomModel1 CustomModel1 { get; set; }
public CustomModel2 CustomModel2{ get; set; }
}
를 사용하고, 나는 양식을 가지고 있고 그 안에 내가 @Html.EditorFor
대신 @Html.Partial
을 사용하고 있습니다 제출 됨)은 비어 있습니다. 나는 "콘텐츠"를 설정하면
The model item passed into the dictionary is null, but this dictionary requires a non-null model item of type 'System.Int32'.
보기 : 그러나 내가 템플릿으로
@Html.EditorFor(m => m.CustomModel1, "~/Views/Common/_CustomPartialView.cshtml")
나는 다음과 같은 오류를 얻을 "콘텐츠"보기를 @Html.EditorFor
를 사용하여 통과
@Html.EditorFor(m => m.CustomModel1, Constants.CustomEmbeddedView1)
"임베디드 리소스"가되는 것이 좋습니다.
이 문제를 해결할 방법이 있습니까? 아마도 @Html.EditorFor
을 사용하는 대신 모델 바인딩 문제에 대한 또 다른 해결책이있을 수 있습니다.