November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
You must use the <EPiServer:Property .. > control for DynamicContent to render properly, calling <%= CurrentPage.Property["DynamicContentProperty"] %> will not work.
/johan
Hi,
I am using the same and its working properly if we are accessing directly the page where we have inserted the "Dynamic Content".My problem is a bit diferent, I have "DynamicContent" inside a page called"Banner", this banner is present under a page called Banner group which contains no of banners.Whenever a user tries to acees bannergroup all the banners inside the page BannerGroup sjould be rendered. Here all are working properly Except Banner which have dynamic content inside.
I am using the following code to show all the banners inside the BannerGroup page
ArrayList arrBanners;
protected Repeater rptBannerGroup;
string strBannerContent = PropertyTool.Instance.getStringProperty(banner, "BannerContent");
arrBanners.Add(UpdateBannerContent(strBannerContent));
rptBannerGroup.DataSource = arrBanners;
rptBannerGroup.DataBind();
Without knowing anything about the "PropertyTool" you are using, it seems to me as if the bannercontent
is retrieved as a string from the property named "BannerContent":
string strBannerContent = PropertyTool.Instance.getStringProperty(banner, "BannerContent");
If thats the case, then DynamicContent wont render correctlym you'll need to add the content through the EPiServer:Property control.
/johan
Hi,
Can i use Episerver:Property control in Code behind ie:using C#, If yes can u please help me by giving some clue how to use it...
thanks
Hi
You can, but in order for them to render correctly, you'd have to add the propertycontrols to the controlcollection and then
call RenderControl() on it:
Control propertyControl = new EPiServer.Web.WebControls.Property();
propertyControl.PageLink = banner.PageLink;
propertyControl.PropertyName = "BannerContent";
Controls.Add( propertyControl );
But, as it seems as if the resulting banners are to be used in a webcontrol thats databound anyway, cant you just put the Propety-control in the markuptemplate for the rptBannerGroup-control ?
Hi ,
I have renderd it properly, the Ui looks as it should be,Bt now am facing different problem.Button click events is not working properly as it has aquired different ID.
Hi!
Is the button created by the DynamicContent-plugin?
If so, try assign an ID to the Property-control you create.
/johan
Hi,
I am using following code to render Dynamic content,
PropertyLongStringControl ctrl = new PropertyLongStringControl();
ctrl.ID = "DynamicContentBanner";
ctrl.PageLink = banner.PageLink;
ctrl.PropertyData = banner.Property["BannerContent"];
ctrl.SetupControl();
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
var page = new FormlessPage();
page.Controls.Add(ctrl);
HttpContext.Current.Server.Execute(page, htw, false);
//ctrl.RenderControl(htw);
arrBanners.Add(UpdateBannerContent(sw.ToString()));
Here "RenderControl(htw)" throws exception the ""ctl01_hiddenTripType' of type 'HiddenField' must be placed inside a form tag with runat=server""
so i am using "HttpContext.Current.Server.Execute(page, htw, false);" bt in this case button click event which is created in Dynamic Content control is not being fired..
is it possible to use dynamic content in this way???
please help
thanks.
Hi
If you are executing your code in context of some page event, then it would be simpler to just add the propertycontrol to
"your" page, then call Control.RenderControl( htw ), and then afterwards remove it from the controlcollection.
/johan
The easy way is to Make a list of all the banner pages and bind it to this repeater
<asp:Repeater runat="server">
<ItemTemplate>
<EPiServer:Property runat="server" PropertyName="BannerContent" />
</ItemTemplate>
</asp:Repeater>
Hi
You can get all your banners like this:
var banners=EPiServer.DataFactory.Instance.GetChildre(new PageReference(your id with banners));
then you can filter out those the user is not allowed to see and that is published like this
var access = new FilterAccess();
access.RequiredAccess = AccessLevel.Read;
access.Filter(banners);
var published = new FilterPublished();
published.Filter(banners);
then you can bind it to your repeater
List.DataSource=banners;
List.DataBind();
<asp:Repeater runat="server" id="List">
<ItemTemplate>
<EPiServer:Property runat="server" PropertyName="BannerContent" />
</ItemTemplate>
</asp:Repeater>
Hi,
I have a dynamic content as Banner inside a BannerGroup, If we render BannerGroup Page then all the Banners which is inside the Bannergroup page should be renderd, here all the banners are working properly except Banner which is having Dynamic Content it Only Shows " {DynamicContent:MiniCEP}" The dynamic Control Is not being loaded from the bannerGroup page.
Please Help..
Thanks