我在我的視圖文件夾Users
中有一個文件,名爲UserViewControl.cshtml
。在相同視圖文件夾中渲染部分控件
我在實際的視圖(Users.cshtml
)的代碼是:
@Html.RenderPartial("RegisterViewControl")
錯誤:The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments
我不想類型的全是這樣的整體視圖文件夾的路徑可能會在未來的移動:
@Html.RenderPartial("~/Views/Users/RegisterViewControl.cshtml")
守則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)
}
這是一個將由ajax提交的表單,但我希望從viewmodel進行所有驗證。
請留言添加了UserViewControl.cshtml – Clicktricity 2011-01-21 20:47:53