Form is posted to 'Submit' (which is SurfaceController action). After saving data in DB it Redirect execution to another action 'LeadContact' in same controller using MVC
RedirectToAction and pass Id as a paramter to it. In 'LeadContact' model
is populated and passed to 'LeadContact' view.
Yakov Lebski thanks for referenced link. I have gone through it. Just a small question please. Will I need to create Template for every View to render and then put my view logic inside that Template wrapping into a PartialView ?
You can create template for every view,
I prefer use partial macro to render different action on the same template (by using macro container or embed macro in RTE)
I m sorry for asking many things, kindly tolerate I m new to Umbraco.
Just want to clear:
"You can create template for every view"
Does it means create tempalte for every view and then create a content and that content will be basically view and later to hijack routing in Surface Controller ?
I prefer use partial macro to render different action on the same template (by using macro container or embed macro in RTE)
Is it something you can guide and I can do please ? Can you share a little detail on steps please
SurfaceController generate incorrect URL ?
Form is posted to 'Submit' (which is SurfaceController action). After saving data in DB it Redirect execution to another action 'LeadContact' in same controller using MVC RedirectToAction and pass Id as a paramter to it. In 'LeadContact' model is populated and passed to 'LeadContact' view.
Not sure if I m doing correct or incorrect but when 'LeadContact' renders in browser it has incorrect URL. It 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
In short it adds /umbraco/SurfaceContact' into url.
Can you please guide I can correct it and what I m doing wrong ?
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.
In CMS it's works little different, in pure MVC you manage urls by route tables, in CMS url managed by CMS
you can see umbraco reference http://our.umbraco.org/documentation/Reference/Templating/Mvc/forms
ohhh I spent last complete day on this :(
Thanks @YakovLebski for clarifying.
Does it mean existing MVC views cannot be used ?
Please also guide how MVC URL will work for example http://localhost:50656/HealthInsurance/LeadContact?leadOptionId=70 how I can pass query string before in MVC I used to do return RedirectToAction("LeadContact", new { leadOptionId = _id});
Thank you so much for this help.
Yakov Lebski thanks for referenced link. I have gone through it. Just a small question please. Will I need to create Template for every View to render and then put my view logic inside that Template wrapping into a PartialView ?
You can create template for every view, I prefer use partial macro to render different action on the same template (by using macro container or embed macro in RTE)
I m sorry for asking many things, kindly tolerate I m new to Umbraco.
Just want to clear:
Does it means create tempalte for every view and then create a content and that content will be basically view and later to hijack routing in Surface Controller ?
Is it something you can guide and I can do please ? Can you share a little detail on steps please
I highly appreciate your help
option 1: Create template for each action, put hard coded @Html.Action("Action","Controller")
option 2:
.... something like this
is working on a reply...