namespace oek2.Models.MemberProfile
{
public class MemberProfileViewModel
{
public string Room { get; set; }
}
}
SurfaceController:
using System.Web.Mvc;
using oek2.Models.MemberProfile;
namespace oek2.Controllers.MemberProfile
{
public class MemberProfileSurfaceController : Umbraco.Web.Mvc.SurfaceController
{
[HttpPost]
public ActionResult UpdateProfile(MemberProfileViewModel profile)
{
//model not valid, do not save, but return current umbraco page
if (!ModelState.IsValid)
{
return CurrentUmbracoPage();
}
return RedirectToCurrentUmbracoPage();
}
}
}
MVC form post in U6
I am trying to create a simple MVC form in Umbraco 6 using this tutorial: http://our.umbraco.org/documentation/Reference/Mvc/forms/turorial-partial-views
My result is simply an error message: "Error loading Partial View script (file: ~/Views/MacroPartials/MemberProfile.cshtml)"
I have followed the tutorial pretty tight.
PartialView:
@inherits Umbraco.Web.Macros.PartialViewMacroPage @using Umbraco.Web @using oek2.Controllers.MemberProfile @model oek2.Models.MemberProfile.MemberProfileViewModel @using (Html.BeginUmbracoForm<MemberProfileSurfaceController>("UpdateProfile")) { @Html.EditorFor(x => Model) <input type="submit"/> }ViewModel:
namespace oek2.Models.MemberProfile { public class MemberProfileViewModel { public string Room { get; set; } } }SurfaceController:
using System.Web.Mvc; using oek2.Models.MemberProfile; namespace oek2.Controllers.MemberProfile { public class MemberProfileSurfaceController : Umbraco.Web.Mvc.SurfaceController { [HttpPost] public ActionResult UpdateProfile(MemberProfileViewModel profile) { //model not valid, do not save, but return current umbraco page if (!ModelState.IsValid) { return CurrentUmbracoPage(); } return RedirectToCurrentUmbracoPage(); } } }Can someone point me in the right direction?
I don't think you need a partial view macro. Just a normal partial view.
That got me on the right track, thanks
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.