I meant to clarify. The start page of the site uses the "Start" page type. Also, I'm using CMS 6.
I think it's a databinding problem. The PageLink property doesn't bind automatically.
I recreated your situation. It didn't work for me until I put this in this code-behind:
Disclaimer.DataBind();
It worked fine for me after that.
Thanks Deane. Adding the DataBind works.
So, is this issue a quirk/bug with episerver? Shouldn't the control do the binding automatically? Or is this just how .NET is suppose to work?
Controls don't databind automatically. But if you just call "DataBind" in the code-behind, it will bind every control on the page in one shot.
It wouldn't be hard to extend the EPiServer Property control as a "StartPageProperty" control which automatically bound it to the StartPage and so always pulled properties from there. If you have a number of these, that's what I'd do. It would be, maybe, 2-3 lines of code beyond the default class structure.
Just for fun:
using System; using EPiServer.Core; namespace Blend.EPiServer.Controls { public class StartPageProperty : global::EPiServer.Web.WebControls.Property { protected override void OnLoad(EventArgs e) { base.OnLoad(e); PageLink = PageReference.StartPage; DataBind(); } } }
In web.config, under pages/controls:
Then, in the master page:
Newbie... please be gentle.
I'm building a simple site. It currently has two page types, "Start" and "CommonPage". The "Start" page type has a property called "CommonDisclaimer". This property needs to be displayed in the footer of every page.
So, in my master page, I use the following:
<EPiServer:Property ID="Disclaimer" PropertyName="CommonDisclaimer" PageLink="<%#EPiServer.Core.PageReference.StartPage%>" runat="server" />
It works great on the homepage, but not on any of the inner pages, where I instead see a "[Error: No property "CommonDisclaimer".] message.
Oddly, if I replace the PageLink attribute with the ID of the home page, it works correctly on every page.
<EPiServer:Property ID="Disclaimer" PropertyName="CommonDisclaimer" PageLink="3" runat="server" />
Any ideas? I'm really hoping not to have to resort to the code-behind for such a simple task.
Thanks in advance.