I'm working on a bit of code that is using a Form Surface Controller. I've created my model for the form (which contains the 3 fields on the form), a controller and partial view.
All is working well but I need to be able to get to the root page of the site in the partial view to obtain some fields for the drop downs. As I'm not inheriting from UmbracoTemplatePage what's the easiest way to get to the root page of the site?
My code for the model is:
public class FindACarFormModel
{
public string model { get; set; }
public string price { get; set; }
public string age { get; set; }
public string email { get; set; }
}
In my view I need to be able to do functions like CurrentPage.Site() and Umbraco.Content(). Any help would be appreciated!
Form Surface Controllers and Partial Views
Hi,
I'm working on a bit of code that is using a Form Surface Controller. I've created my model for the form (which contains the 3 fields on the form), a controller and partial view.
All is working well but I need to be able to get to the root page of the site in the partial view to obtain some fields for the drop downs. As I'm not inheriting from UmbracoTemplatePage what's the easiest way to get to the root page of the site?
My code for the model is:
In my view I need to be able to do functions like CurrentPage.Site() and Umbraco.Content(). Any help would be appreciated!
Thanks Andy
Hi Andy,
or
Should work.
HTH
Steve
Hi Andy,
If you want to get root node inside current tree - another possibility is to use:
or
And don't use CurrentPage.Site()
Thanks,
Alex
is working on a reply...