0

如果我需要在作曲家块内的自定义控件中使用 PageLink 到当前页面,如何获取它。如果我使用 CurrentPage(PropertyDataControl 的成员,它是我的自定义控件的基类),我会得到 PageData 引用作曲家元素,而不是页面。

4

1 回答 1

1

好的,我设法找到了解决方案。万一有人面临同样的问题,这里是要走的路:

protected PageData CurrentParentPage
        {
            get
            {
                var currentParentPage = PageReference.ParseUrl(Page.Request.UrlReferrer.AbsoluteUri);
                if(!PageReference.IsNullOrEmpty(currentParentPage))
                {
                    return currentParentPage.GetPageFromReference();
                }
                return null;
            }
        }

这应该放在控制类中

于 2013-01-23T13:30:27.387 回答