얘들 아 하나 이상의 모델을 단일보기로 사용하려고했습니다.하나 이상의 모델을 단일보기로 바인딩하는 방법은 무엇입니까?
하지만 구현 방법을 찾을 수 없습니다.
나는이 하나 개의보기
@Html.Partial("Sidebar")
이있다
나는 다음과 같은 코드를 사용했다
단일 과거와 다른 부분에서 다른에 하나의 데이터보기를 ... ... 사용하려면 다른보기입니다
<!-- start content -->
<div id="content">
<div class="post">
<h1 class="title">
Add New Post
</h1>
<p></p>
<div class="entry">
@using (Html.BeginForm())
{
<div>
<div style="display:inline;">
<div style="display: inline; float: left;">
@Html.Label("lblcategory", "Category", new { style = "Width:100px; float: left;" })
<div style="width: 150px; height: 60px; overflow-y: scroll; display: inline; float: left;">
@for (int i = 0; i < (int)TempData["Rows"]; i++)
{
for (int j = 0; j < (int)TempData["Cols"]; j++)
{
<input id="Checkbox + @i" name = "Category" type="checkbox" style="width:50px;" value="@TempData["[" + i.ToString() + "][" + j.ToString() + "]"]"/>
@TempData["[" + i.ToString() + "][" + j.ToString() + "]"]
}
}
@*@Html.LabelFor(model => model.CategoryName)*@
</div>
<div style="float:right;">
<label id="lblcategoryrequired" style="color:Red">@Html.ValidationMessageFor(model => model.CategoryName)</label>
</div>
</div>
</div>
<div>
<p style="display: inline; float: left;">
@Html.Label("lblsubjet", "Subject", new { style = "Width:100px; float: left;" })
@*@Html.TextBox("txtsubject", "", new { style = "Width:700px;" })*@
@Html.TextBoxFor(model => model.PostSubject, new { style = "Width:400px; maxlength=400;" })
<label id="lblsubjectrequired" style="color:Red">@Html.ValidationMessageFor(model => model.PostSubject)</label>
</p>
</div>
<div>
<p style="display: inline; float: left;">
@Html.Label("lblcontent", "Content", new { style = "Width:100px; float: left; Vertical-align:top;" })
@*@Html.TextArea("txtcontent","", new { style = "Width:700px; height:200px; maxlength=700;" })*@
@Html.TextAreaFor(model => model.PostContent, new { style = "Width:400px; height:200px; maxlength=400;" })
</p>
</div>
<div>
<p style="display: inline; float: left;">
@Html.Label("lblblank", "a", new { style = "Width:100px; float: left; Color:#372412" })
<input type="submit" value="Add" id="btnadd" style="width: 100px;" class="button" />
    
<a id="Cancel" href="~/Home/Home"> <input type="button" value="Cancel" id="btncancel" class="button" style="width: 100px;" /></a>
</p>
</div>
</div>
@Html.ValidationSummary(true)
}
</div>
</div>
</div>
</div>
당신은 두 모델이있는 뷰 모델을 가질 수 있고 당신은 당신의보기 –