SaaS CMS has officially launched! Learn more now.

EPiFields and Mirroring (PageID problem)



Im using EPiFeilds to insert linklists on a page. I'm overriding the DataExchange method:

public override void DataExchange(ref PageAdapter adapter, DataExchangeDirection direction)

And upon Direction.SET I'm saving a PageID entered in the ui with:

LinkList cu = adapter as LinkList;  case DataExchangeDirection.SET: cu.PageId = PageId.Text;     break; 

In the UserControl (Inheriting from PageAdapter) that shows this LinkList I'm fetching the value overriding the LoadState as:

protected override void LoadState(object oState) { object[] myState = (object[])oState;              PageId = myState[0].ToString();          } 

All this works as intended and with this I can insert LinkedLists using EPiFields. Now, my problem is mirroring.

The site is to be mirrored and when this happens, all the PageID in these EPiFields LinkLists breaks since the mirrored pages gets different PageID's then the original site. Is there anyway to either force EPiServer to conserve PageID's through mirroring (I doubt this) or is there any way I can store this PageID so that it gets updated in the mirroring?

Any help with this issue would be gratly appreciated!

 / Johan 

Apr 17, 2008 10:22

Hi Johan!

This would be a problem with the current implemention of EPiFields.

We did some work to get EPiFields own pagereference safe for mirroring, but that wont take care of any pagereferences the adapters maintains themselves.

But, it seems to me as if your adapter should render a linklist based on a PageReference, for example by listing children to the page.

If this is the case, I'd suggest you to instead of maintaining the PageId yourself, simply make the PageAdapter work for "any selected page" by simply overriding the method ActivateForPage and return true if the passed in PageReference is not EmptyReference.

By doing this, your adapter would appear in the list of available adapters when user selects a page in the tree, and your PageAdapter code then simply uses the property CurrentPageReference which will point to the page the user selected when adding the field.

This CurrentPageReference will be exported / imported correctly during mirroring (if you applied the latest hotfixes to both episerver 4 and epifields).


Apr 17, 2008 11:16
Apr 17, 2008 11:22

I'm not sure I'm following, does this mean that the Page where I insert the EPiField-linklist will have to serve as the container for the LinkList as well? If this is the case, it kind of defeats the purpouse with beeing able to have several different Link-lists in the same page since these lists then will be merged to one. Am I understanding this correctly?

 I have been giving it some thought and I think I may have found a plausible solution:

 I'll give all pagetypes a guid property and upon fetching the PageCreated event give them all a unique guid. I'll use this guid when saving the Link-list container in the EPiFields and then search on this pageproperty instead of pageid. This will definitly be much slower, but it should at least conserve this id through mirroring I guess. This should work, right?

Apr 18, 2008 13:56

> I'm not sure I'm following, does this mean that the Page where I insert the EPiField-linklist will have to serve as the container for the LinkList as well?

No, the page that you *insert* through epifields acts as the container.

Consider for example the following scenario:

1. Webeditor is editing Page A
2. Webeditor selects EPiField  dialogbox and from its navigation tree selects Page B
3. Webeditor selects your PageAdapter from the list of available adapters
4. Webeditor then clicks ok, and the epifieldobject is inserted

Now, Page B will act as the container for the linklist.

This would however require your pageadapter to be available regardless of what page(type) is selected, and that can be done as I said by overriding the ActivateForPage method.


Apr 18, 2008 15:54
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.