Copied to clipboard

Flag this post as spam?

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


  • suzyb 474 posts 932 karma points
    Nov 27, 2012 @ 15:44
    suzyb
    0

    Inherit property value closest parent c#

    I have a property on my document type advert and I have a user control that outputs the value of this property. 

    I want to recursivly select this property from the closest parent that has it set.

    -- Home
    ---- Page 1
    ---- Sub Page 1

    So in the above structure, sub page 1 would recurse up the tree till it finds a page with the property set and it would output that.

    In xslt this gives me the node ID of the closest parent with the property set

    $currentPage/ancestor-or-self::* [@isDoc and leftAdvert != ''][1]/leftAdvert

    In c# I could just recurse up the tree but wonder if there is a better way to do this.  Is there or should I just recurse.

     

Please Sign in or register to post replies

Write your reply to:

Draft