November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
It is probably a data binding problem in ASP.NET, the property in the PageData object should be there if it has a value. The <%# tags requires databinding to be evaluated, the second example code does not require databinding.
Yes the value is there in the aspx page when I dubug but its not pusing through to the ascx control? I was wondering if its trying to render the control before evaulating the property which is needed within it or something?
Could be, where are you databinding (the actual call to DataBind()) and where is the logic done in the NowPlaying? By "where" I mean in which event in the page life cycle.
A quick fix is to assign ArticleID in the OnInit event in code behind instead.
I tried this
Episerver property = <EPiServer:Property ID="Property1" runat="server" PropertyName="test" /><br />
ASP Literal = <asp:Literal ID="test" runat="server" Text=<%# CurrentPage["test"].ToString() %> /><br />
and it outputs the following
Episerver property = 87
ASP Literal =
So why are they outputting differant things when they referance the same property??
Well, <%# is the magic ASP.NET keyword for databinding, it will not be evaluated if you don't call DataBind. Otherwise just assign the values from code behind instead.
I have a control within a page which needs a value to be passed to it but when I try and put in an episerver value it cant see it?
<uc2:NowPlaying ID="myControl" runat="server" ArticleID=<%# CurrentPage["testString"].ToString() %> />
but the follwoing works fine
<uc2:NowPlaying ID="NowPlaying1" runat="server" ArticleID=90 />
The control needs the property from th epage to work, I cant put the property in the control as sometimes its not the data from teh current page which will be used.