November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Using <%= will only work for string values, you need to use #:
PageLink="<%# CurrentPage["myProperty"] %>
Also: remember to databind your controls from codebehind.
aaah... I did not bind each EPiServer:Property.
Basic, I know. But been away from EPiCode a long time :)
But I'm not able to find my Property1 controller in Page_Load.
Do I have to do a FindControll on PageRender or something?
Well this is more .net than EPiServer related.
If you add a webcontrol to your .aspx file the .aspx.cs.designer file should be updated with a reference to your added control, thereby making Property1 available as an object in your codebehind. So no, not necessary to use FindControl.
If your .designer file isn't updated, google will help you.
I REALLY don't like .NET anymore
I found a workaround however: http://world.episerver.com/Forum/Pages/Thread.aspx?id=13276&epslanguage=en
What is wrong with the following? No databinding required.
<EPiServer:Property runat="server" PageLinkProperty="myProperty" PropertyName="MainIntro" />
Where myProperty is a PageReference property on the current page and MainIntro is a property on the page myProperty points to.
Nothing wrong with it, just explaining why his example failed. You're right, using PageLinkProperty is better.
@Frederik Thanks. That worked perfectly.
I had tried that. But what I did wrong, was this: PageLinkProperty="<%= CurrentPage["myProperty"] %>"
But now that I understand how PageLinkProperty works, it's all sweet :)
First: I'm stuck with EPi 4.61 :(
I need to display data from a specific page. In my template I have a PageReference property, which I use to link up to the page I need to get info from.
This code works:
<asp:Content ID="rightColumnRegion" ContentPlaceHolderID="rightColumnRegion" runat="server">
<h2 class="defaultGreen"><EPiServer:Property ID="Property1" PageLink="3212" PropertyName="PageName" runat="server" /></h2>
<div class="spacer10px"></div>
<p><EPiServer:Property ID="Property2" PageLink="3212" PropertyName="MainIntro" runat="server" /></p>
<EPiServer:Property ID="Property3" PageLink="3212" PropertyName="PageLink" runat="server" />
</asp:Content>
The problem is when I try to replace '3212' with my page property. The following does not work:
PageLink="<%= CurrentPage["myProperty"]" %>
So how can I do this?