Persisting data from one Razor view to SurfaceControlller to another view
Hey Guys,
First post and still fairly new to the Umbraco world, but managed to get to grips with most aspects so far. I have run into a problem now though and would like to get your input if I may.
I basically have a page with a list of items and each item has a link which needs to point to another page with an umbraco form. The form needs to have a pre-populated field based on the link that was clicked on the previous page.
Which is the best way to approach this problem? Should I point the links to a SurfaceController method along with the relevant parameter and some how persist it to the next view? I don't know if that's possible in Umbraco - but that's the way I'd approach it from my MVC background.
Thanks for the reply! Still not having much luck persisting the parameter from the SurfaceController GET method to the view/page. Currently storing it in TempData (also tried the ViewData and ViewBag) for access in the view. Is there another approach that I should be using instead?
public ActionResult Apply(string vacancyTitle)
{
TempData.Add("VacancyTitle", vacancyTitle);
var ap = uQuery.GetRootNode().GetDescendantOrSelfNodes().Where(x => x.Name == "Application").First();
Persisting data from one Razor view to SurfaceControlller to another view
Hey Guys,
First post and still fairly new to the Umbraco world, but managed to get to grips with most aspects so far. I have run into a problem now though and would like to get your input if I may.
I basically have a page with a list of items and each item has a link which needs to point to another page with an umbraco form. The form needs to have a pre-populated field based on the link that was clicked on the previous page.
Which is the best way to approach this problem? Should I point the links to a SurfaceController method along with the relevant parameter and some how persist it to the next view? I don't know if that's possible in Umbraco - but that's the way I'd approach it from my MVC background.
A surface controller would be a good place to start. From then on you can do most of the things that you are used too with regula MVC
Thanks for the reply! Still not having much luck persisting the parameter from the SurfaceController GET method to the view/page. Currently storing it in TempData (also tried the ViewData and ViewBag) for access in the view. Is there another approach that I should be using instead?
public ActionResult Apply(string vacancyTitle)
{
TempData.Add("VacancyTitle", vacancyTitle);
var ap = uQuery.GetRootNode().GetDescendantOrSelfNodes().Where(x => x.Name == "Application").First();
return RedirectToUmbracoPage(ap.Id);
}
TempData has miraculously sprung into action and I can now access the values required.
Not sure what happened there!
is working on a reply...