how to use RedirectToAction correctly in SurfaceController ?
I m submiting a form to SurfaceController's action 'Submit'. Where after saving data it Redirect to another action 'LeadContact' using MVC RedirectToAction and pass Id as a paramter to it. In 'LeadContact' model is being populating and passed to 'LeadContact' view.
how to use RedirectToAction correctly in SurfaceController ?
I m submiting a form to SurfaceController's action 'Submit'. Where after saving data it Redirect to another action 'LeadContact' using MVC RedirectToAction and pass Id as a paramter to it. In 'LeadContact' model is being populating and passed to 'LeadContact' view.
Not sure if I m doing correctly or not but when 'LeadContact' renders in browser it amends URL. Browser shows URL like http://localhost:50656/umbraco/Surface/HealthInsurance/LeadContact?leadOptionId=70 while I m expecting it should be http://localhost:50656/HealthInsurance/LeadContact?leadOptionId=70
Can you please guide I can correct it ? Below is my code:
public ActionResult Submit(FormCollection form)
{
//Some logic and later redirect to another action 'LeadContact'
return RedirectToAction("LeadContact", new { leadOptionId = _id});
}
public ActionResult LeadContact(int leadOptionId)
{
MyViewModel model = new MyViewModel();
//Lines of code to populate data into model
return View("LeadContact", model);
}
Thanks for your help and sharing.
Have a look at the documentation for surface controllers. The routing is explained there :
http://our.umbraco.org/documentation/Reference/Templating/Mvc/surface-controllers
But you can have your own custom routes. have a look at the documentation here :
http://our.umbraco.org/documentation/Reference/Templating/Mvc/custom-routes
Dave
is working on a reply...