Try our conversational search powered by Generative AI!

InnerProperty error



I am using the InnerProperty to set an property from an other page in code behind like this:


<EPiServer:Property ID="LinkProp" runat="server" DisplayMissingMessage="false"/>


PageData pd = EPiServer.DataFactory.Instance.GetPage(CurrentPage["PageNameProperty"] as PageReference);

PropertyData linkproperty = pd.Property["LinkName"];

if (linkproperty != null){
LinkProp.InnerProperty = linkproperty; 
This worked before I upgraded to CMS 6 R2 but now it does not seem to work correctly.
The stage thing is if I add an other copy of the same line, so the method look like this, it works (I found this after some debugging).
if (linkproperty != null){
LinkProp.InnerProperty = linkproperty;  
LinkProp.InnerProperty = linkproperty; 
What could cause this error?
Best regards



Jun 28, 2011 17:11

My guess is that you set InnerProperty too late so the Child Controls already are created.

Try to analyze the steps taken in each phase of the pages life cycle.

Try if a call to LinkProp.DataBind() will make the InnerProperty to work as expected. If yes, this is an indication of that the control called CreatedChildControls before InnerProperty was set and DataBind will clear all the child controls and recreate them. Note that a call to DataBind is not a a good solution.

Jun 29, 2011 1:17

this did not solve my problem, but I changed it according to your "Best Coding Practices - EPiServer CMS", published in dec 2009... which I should have thought of earlier...


<div><EPiServer:Property PageLinkProperty="PageNameProperty" PropertyName="LinkName" runat="server" /></div>


So thanks anyway!

Jun 29, 2011 15:28


I'm having the same problem. I upgraded from 5R2 to 6R2 and started having this problem.

The following lines of code are run in CreateChildControls and were working fine before the upgrade:

            var pd = DataFactory.Instance.GetDefaultPageData(PageReference.StartPage, Settings.MetadataSetupDummyPageTypeId);

  emneProperty.InnerProperty = pd.Property["Emne"];


pd.Property["Emne"] is not null, but is a CustomProperty (when I check it in the debugger it is displayed as "EPiServer.Core.PropertyData {KL.KLDK.Web.Backend.CustomProperties.AutoCompleteSelector.AutoCompleteSelector}").

After the InnerProperty has been set with the code above, it's value is null. If you set it twice (run the same line of code twice) everything works fine.


This must be a bug somewhere...

My current workaround is running the code line twice, but some help with another way of doing this or a fix would be much appreciated.



Aug 24, 2011 9:56

@Daniel: What value is null?

Using InnerProperty only affects internal values but does not trigger recreation of ChildControls.

Setting it twice sounds strange. When using the Reflector there is nothing that indicates that it should affect anything.

Aug 24, 2011 11:49

Hi Fredrik,

emneProperty.InnerProperty == null  ==> true


That is until I set it the second time - then it equals pd.Property["Emne"].


Very strange problem. And I agree with you that there's no indication of this "multi setting" affecting it anyhow. I'm clueless...


Aug 24, 2011 12:06

Ah! I found it :)

It is a bug!

Setting InnerProperty first set _propertyData that is the backing field to InnerProperty.

Then it updated PropertyName to the value of InnerProperty.Name.

The setter for PropertyName clears _propertyData if the value is changed.

Aug 24, 2011 12:36

That makes sense (well, it doesn't make sense that it does that, but now the reaction makes sense!). 


What's your suggestion concerning this? Just setting it twice seems to do the trick. Will you make sure it's fixed in upcoming releases?


Thank you for your swift and effective replies.


Aug 24, 2011 12:43
Bug #72634: Setting InnerProperty resets _pageData
Aug 24, 2011 21:12
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.