November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
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.
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!
Hi,
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.
Thanks
Daniel
@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.
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...
BR
Daniel
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.
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.
Daniel
Hi!
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);