0
I이 데이터 모델ASP MVC 부분보기 모델
public partial class UsersInfo
{
public int UserID { get; set; }
public string Name_f { get; set; }
public string Name_l { get; set; }
public string Photo { get; set; }
public bool ActiveAccount { get; set; }
}
public partial class Employee
{
public int EmpID { get; set; }
public int BranchID { get; set; }
public virtual UsersInfo UsersInfo { get; set; }
}
와 나는이 양식을 렌더링하고있어에게했습니다
@model LoanApp.Models.DataBaseModel.Employee
@using (Html.BeginForm((string)ViewBag.Contoler, "Employe", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
@Html.Partial("~/Views/Shared/_userInfo.cshtml",Model.UsersInfo)
<label class="control-label">يعمل في فــرع</label>
@Html.DropDownList("BranchID", null, htmlAttributes: new { @class = "form-control" })
<input type="submit" value="Save" class="btn btn default" />
}
이 내 부분보기
@model LoanApp.Models.DataBaseModel.UsersInfo
@Html.TextBoxFor(x => x.Name_f, new { @class = "form-control", @placeholder = "الاسم الاول", @required = "" })
@Html.TextBoxFor(x => x.Name_l, new { @class = "form-control", @placeholder = "الاسم الاخير", @required = "" })
@Html.TextBoxFor(x => x.PhoneNumber, new { @class = "form-control", @required = "", @number = "true" })
I입니다 내 게시물 편집 방법을 대신 null
에서 개체를 가지고 싶습니다, 내가 무엇이없는 것 같지 않아요
문제는 귀하의 게시물 방법 [Bind(Include = "some property")]
하나 테이블 직원 및 사용자 정보
양식은 어디에 있습니까? HttpPost 액션 메소드는 어떻게 보이며 예상되는 동작은 무엇입니까? – Shyju
복잡한 속성이 자동으로 직렬화되지 않는다고 생각합니다. – TheVillageIdiot
POST 방법을 보여줘야합니다. 모델과 일치하지 않는 ChildViewModel에 대한 생성 폼 컨트롤. 부분적이 아닌'EditorTemplate'을 사용하여'name' 속성이 올바르게 접두어로 붙습니다. –