I'm trying all shapes to get access to my current page in my surfacecontroller but no luck...aarrrgghhh.
Everything looks correct, but when i place a breakpoint in my English Action current page gives me
Cannot find the Umbraco route definition in the route values, the request must be made in the context of an Umbraco request.
Any help would be appreciated before I stamp on my PC!!!!
Trouble getting CurrentPage in surface controller
I'm trying all shapes to get access to my current page in my surfacecontroller but no luck...aarrrgghhh. Everything looks correct, but when i place a breakpoint in my English Action current page gives me Cannot find the Umbraco route definition in the route values, the request must be made in the context of an Umbraco request.
Any help would be appreciated before I stamp on my PC!!!!
@using (Html.BeginUmbracoForm("LanguageSelect"))
{
}
public ActionResult English()
{
var ss = CurrentPage;
return Redirect(url + "?lang=en-GB");
}
Hi Craig
Could this help? https://our.umbraco.org/forum/developers/api-questions/41964-Getting-CurrentPage-context-in-Surface-controller-without-BeginUmbracoForm?p=0#comment153962
/Jan
Thanks for getting back to Jan,
I kinda worked it out. I have two submit buttons within the one form, so have an additional Action
public ActionResult LanguageSelect(string submitButton)
{
switch (submitButton)
{
case "English":
return RedirectToAction("English", new { currentId = CurrentPage.Id });
case "Welsh":
return RedirectToAction("Welsh", new { currentId = CurrentPage.Id });
default:
return null;
}
}
is working on a reply...