Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jason Espin 368 posts 1335 karma points
    Jun 18, 2015 @ 11:08
    Jason Espin
    0

    Accessing Model.Content in a HTML.Action call

    Hi all,

    I have been following this tutorial closely to try and produce a booking process for my site.

    http://umbraco.com/follow-us/blog-archive/2015/2/13/creating-multi-step-forms-using-a-surfacecontroller

    In my template, I am returning a partial view using the following code:

    @Html.Action("ShowBookingForm", "TourBooking")
    

    What I now need to do is access a property on the current page from within the ShowBookingForm partial view. How can I do this as my partial view is defined as follows:

    @using Iceland_Mountain_Guides.Controllers
    @model Iceland_Mountain_Guides.Models.TourBookingModel
    

    This means that I cannot access the page properties because I do not inherit from:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    

    Any help would be greatly appreciated.

  • Frederik Raabye 72 posts 276 karma points MVP 2x c-trib
    Jun 18, 2015 @ 11:22
    Frederik Raabye
    0

    Did you try this: @inherits Umbraco.Web.Mvc.UmbracoViewPage

  • Steven Harland 78 posts 518 karma points c-trib
    Jun 18, 2015 @ 12:06
    Steven Harland
    0

    Hi Jason,

    You could add the property to your model and set it in your ShowBookingForm method where you'll have access to CurrentPage.

Please Sign in or register to post replies

Write your reply to:

Draft