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

    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.

    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 275 karma points MVP 2x c-trib
    Jun 18, 2015 @ 11:22
    Frederik Raabye

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

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

    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: