Copied to clipboard

Flag this post as spam?

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


  • Moran 277 posts 885 karma points
    Feb 18, 2015 @ 09:33
    Moran
    0

    Get current node from "UmbracoViewPage"

    Hi I am using UmbracoViewPage in my contact form to get my custom model:

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<Umbraco710Source.Models.ContactViewModel>
    

    But I can't use:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    

    How can't I use my property fileds besides using

    @Umbraco.Field
    

    I also need to use the Vorto extenstion which I can't use with @Umbraco.Field

    Thanks

  • Sören Deger 726 posts 2833 karma points c-trib
    Feb 18, 2015 @ 09:43
    Sören Deger
    0

    Hi Moran,

    maybe this can help you:

    https://our.umbraco.org/forum/developers/api-questions/52597-What-is-the-difference-between-UmbracoViewPage-and-UmbracoTemplatePage

    You can use the @Model.Content syntax to solve this.

     

    Best regards

    Sören

  • Moran 277 posts 885 karma points
    Feb 18, 2015 @ 10:17
    Moran
    0

    Hi Thanks, but I already tried it and it doesn't work. I get and error when I try to use

    @Model.Content
    

    http://screencast.com/t/hIztq3m8k

  • Sören Deger 726 posts 2833 karma points c-trib
    Feb 18, 2015 @ 10:34
    Sören Deger
    0

    Hi Moran, 

    have you import the vortoextension like this?

    @using  Our.Umbraco.Vorto.Extensions;
    This is described here:
    Best regards,
    Sören
  • Moran 277 posts 885 karma points
    Feb 18, 2015 @ 11:12
    Moran
    0

    Yes of course, By the way the link you wrote here is my question :) My issue is getting the @Model.Content to work, you can see it in my screenshot. http://screencast.com/t/hIztq3m8k

  • Sören Deger 726 posts 2833 karma points c-trib
    Feb 18, 2015 @ 11:22
    Sören Deger
    0

    Ok, I don't use vorto this time. Please create a new topic directly in the vorto forum here and link to this topic:

    https://our.umbraco.org/projects/backoffice-extensions/vorto/bugs-feedback-suggestions

    Then the package owner (Matt Brailsford) can see this and help you ;-)

     

    Best regards,

    Sören

  • Moran 277 posts 885 karma points
    Feb 18, 2015 @ 12:00
    Moran
    0

    My issue isn't with the Vorto package, but with Umbraco. I can't seem to get the @Model.Content to work... once, I can get it to work I'll be able to use the Vorto package.

    How can I use @Model.Content inside UmbracoViewPage?

    http://screencast.com/t/JneTEplY4MOW

  • Sören Deger 726 posts 2833 karma points c-trib
    Feb 18, 2015 @ 12:12
    Sören Deger
    100

    Ok, it seems that the issue comes from your custom contactViewModel. Model.Content needs an IPublishedContent.

    Maybe you can create a new model (i.e. called CurrentPage) of type IPublishContent (Documentation: https://our.umbraco.org/documentation/Reference/Querying/UmbracoHelper/).

    With this new model you should can use this (CurrentPage.Content)

     

  • Moran 277 posts 885 karma points
    Feb 18, 2015 @ 14:40
    Moran
    1

    Thanks for the help, I build an Id field in my model for the page Id.

    the view Model

    public int CurrentPageId { get; set; }
    

    and called it from my view

    @Html.Raw(Umbraco.TypedContent(Model.CurrentPageId).GetVortoValue("contactThanks", recursive:true))
    

    You're great man!!!

  • 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