Tôi có một tệp trong thư mục xem của mình Users
được gọi là UserViewControl.cshtml
.Điều khiển RenderPartial trong cùng một thư mục xem
Mã của tôi trong giao diện thực tế (Users.cshtml
) là:
@Html.RenderPartial("RegisterViewControl")
Lỗi: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments
Tôi không muốn phải gõ đường dẫn đầy như thế này như các thư mục toàn bộ xem có thể di chuyển trong tương lai :
@Html.RenderPartial("~/Views/Users/RegisterViewControl.cshtml")
Mã trong RegisterViewControl.cshtml:
@model SampleMVC.Web.ViewModels.RegisterModel
@using (Html.BeginForm("Register", "Auth", FormMethod.Post, new { Id = "ERForm" }))
{
@Html.TextBoxFor(model => model.Name)
@Html.TextBoxFor(model => model.Email)
@Html.PasswordFor(model => model.Password)
}
Đây là biểu mẫu sẽ được gửi bởi ajax, nhưng tôi muốn tất cả xác thực từ chế độ xem.
xin vui lòng gửi mã trong UserViewControl.cshtml – Clicktricity
@Clicktricity được thêm vào. –