Copied to clipboard

Flag this post as spam?

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


  • Mehul Gajjar 48 posts 172 karma points
    Apr 21, 2015 @ 13:47
    Mehul Gajjar
    0

    Unable to get content using umbracoHelper.TypedContentAtXPath

    Hi 

    i am using umbrraco 7.2.4  ,  i need to get data using umbracoHelper.TypedContentAtXPath but unable to get data.

    kindly see below , what i am missed ? :(

    OR   is ther any other way to get node or data  from url using UmbracoHelper

    can any body help on this

    Thanks in advance

     

    Regards

    Mehul Gajjar.


  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Apr 21, 2015 @ 16:46
    Alex Skrypnyk
    0

    Hi Mehul,

    Try to use $root variable, like that $root//go-further, where is your node go-further placed ?

    Did you loot at umbraco.config, it's easy to write xpath when you are looking at xml content.

    Thanks, Alex

  • Mehul Gajjar 48 posts 172 karma points
    Apr 22, 2015 @ 07:55
    Mehul Gajjar
    0

    Hi Alex 

    Thanks for reply , i am using below function still  not get any luck 

     

    public static IPublishedContent GetNode()

    {

        var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);

        var rootNode = umbracoHelper.TypedContentSingleAtXPath("$root//go-further"));

        return rootNode;

    }

     

    "go-futher" is my text page of umbraco starter kit it is in content 

    Kindly help on this.

    Regards

    Mehul Gajjar.

     

     

  • Mehul Gajjar 48 posts 172 karma points
    May 04, 2015 @ 10:06
    Mehul Gajjar
    100

    Hi ,

    i have found the solution as below

    var umbracoHelper = new Umbraco.Web.UmbracoHelper(UmbracoContext.Current);
    IEnumerable<IPublishedContent> node2 = umbracoHelper.TypedContentAtXPath("//*[@urlName='go-further']");
    

    by this way you can query on umbraco helper to get node.

    Cheers.

    Regards

    Mehul Gajjar.

Please Sign in or register to post replies

Write your reply to:

Draft