Sunday, May 31, 2009

Getting Ancestor item based on Template ID

public static Item GetAncestorItemBasedOnTemplateID(Item item)
{
var filter = "";

filter += string.Format("contains('{0}', @@templateid)", item["templates"]);
return item.Axes.SelectSingleItem("ancestor-or-self::*[" + filter + "]");
}

No comments:

Post a Comment