在Episerver 6中,如何在不同的页面上查找页面的所有子页面ID? [英] In Episerver 6, how to find all child pages id's of a page on an different page?

查看:127
本文介绍了在Episerver 6中,如何在不同的页面上查找页面的所有子页面ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Episerver 6中,如何在不同页面上查找页面的所有子页面ID?

In Episerver 6, how to find all child pages id''s of a page on an different page?

推荐答案





通过使用方法GetDescendents(),您将获得所有子页面的详细信息或说出子页面。并且你可以使用你想要使用的任何属性或id。



示例:

Hi,

By using the the method GetDescendents() you will get the details of all subpages or say child pages. and you can the required attributes or id whatever you want to use.

Example:
 public static List<T> GetDescendentsOfType<T>(this DataFactory dataFactory, PageReference pageLink)
        {
            var listOfPages = dataFactory.GetDescendents(pageLink);
            var pageData = new PageDataCollection();
            foreach (var reference in listOfPages)
            {
                var page = dataFactory.GetPage(reference);
// Here you can access the id of sub pages
var id=page.PageTypeId;<b></b>
                if (page is T)
                    pageData.Add(page);
            }
            return pageData.Cast<T>().ToList();
        }


这篇关于在Episerver 6中,如何在不同的页面上查找页面的所有子页面ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆