Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a couple of issues.
I have a page template called ProfileInfo.cshtml this template includes a partialview which contains a form which posts back to a surface controller.
If I declare the form using @using(Html.BeginUmbracoForm<PortalProfileSurfaceController>("SubmitForm") it adds the wrong action to the form (it adds the URL of the template page. I hava had to override the action to get it to post to the correct controller/action!
After overiding the action to get it to post to the controller, I get the following error
Can only use UmbracoPageResult in the context of an Http POST when using a SurfaceController form
when doing return CurrentUmbracoPage()
Managed to get it to work in the end. The problem was with passing the model to the forms partial view
and using @model Mymodel in the partial view.
If I moved myModel's init code to the partial view instead of passing from the main template page and used
@inherits UmbracoViewPage instead of @model Mymodel in the partialView everything started working (except myModel was always empty in the controller), to fix that I had to do
public IActionResult SubmitForm([Bind(Prefix="vm")]ProfileModel model)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted