What this gives you back?
ServiceLocator.Current.GetInstance<PageRouteHelper>().Page
Valdis, thank you! Unfortunately I can't find Service Locator and PageRouteHelper in Epi 6 R2. Sorry for not specifying the version earlier.
Oh, well. I do not have v6 dlls at hand, but I at least can see that there is "PropertyLongString.PageLink" property in v9. That shold link you back to current page. Do you have similar property in v6?
Valdis,
This actually works fine when SAVING the page: DataFactory.Instance.GetPage(new PageReference(this.Parent[2].ToString())).PageName.ToString()
but the happiness was short-lived: it breaks when EDITING the page, because the this.parent[2] is evaluated differently then (an id which doesn't exist).
Makes me think this is to do with the fact the page wasn't saved the first time the method was invoked.
Also, another concern is referencing by index [2], in case the index changes in a subsequent Epi version in PropertyDataCollection types.
//later edit: Ah there it is. Can use PageParentLink instead of index 2
[PageTypeProperty(
EditCaption = "My property",
Required = true,
Type = typeof(MyCustomPropertyType)
)]
public virtual string MyProperty { get; set; }
Inside my MyCustomPropertyType (subclass of PropertyLongString), can I in any way reference my CurrentPage (which is an instance of the page type
that contains MyProperty)?
(I need this because, based on its PageTypeID, I return a slightly different PropertyDataControl). Any workaround for this?