Copied to clipboard

Flag this post as spam?

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


  • John Churchley 272 posts 1257 karma points c-trib
    Dec 04, 2015 @ 11:15
    John Churchley
    0

    Full Umbraco Helper in a RenderMvcController

    How do you get full umbraco helper support in an RenderMVCController?

    using Umbraco.Core.Models;
    using Umbraco.Web.Models;
    
    public class BlogAreaController : Umbraco.Web.Mvc.RenderMvcController
        {
            public override ActionResult Index(RenderModel model)
            {
                model.Content.GetProperty("title").Value
                return View();
            }
    }
    

    I only seem to get partial support i.e. x.GetProperty() but not x.GetPropertyValue()?

    //JC

  • Anders Bjerner 448 posts 2601 karma points MVP 4x admin c-trib
    Dec 04, 2015 @ 11:38
    Anders Bjerner
    101

    Hi John,

    GetPropertyValue is an extension method. If you import the namespace Umbraco.Web, you should be good to go ;)

    If you also need something similar to @Umbraco in your MVC views, youcan initialize a new helper like this:

    UmbracoHelper helper = new UmbracoHelper(UmbracoContext.Current);
    

    Both the UmbracoHelper and UmbracoContext classes also lives in the Umbraco.Web namespace.

  • John Churchley 272 posts 1257 karma points c-trib
    Dec 04, 2015 @ 11:42
    John Churchley
    0

    Hi Ander,

    Thank you!

    John

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies