November Happy Hour will be moved to Thursday December 5th.

Dynamic Content Inside some other pages.

Vote:
 

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

#53662
Sep 19, 2011 9:43
Vote:
 

You must use the <EPiServer:Property .. > control for DynamicContent to render properly, calling <%= CurrentPage.Property["DynamicContentProperty"] %> will not work.

/johan

#53663
Sep 19, 2011 10:03
Vote:
 

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();
 

 

#53665
Sep 19, 2011 12:39
Vote:
 

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

#53666
Sep 19, 2011 13:02
Vote:
 

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

#53689
Sep 20, 2011 11:02
Vote:
 

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 ?

 

#53690
Sep 20, 2011 11:23
Vote:
 

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.

 

#53692
Sep 20, 2011 15:17
Vote:
 

Hi!

Is the button created by the DynamicContent-plugin?
If so, try assign an ID to the Property-control you create.

/johan

#53721
Sep 21, 2011 9:40
Vote:
 

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.

#53736
Sep 21, 2011 15:09
Vote:
 

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

 

 

#53752
Sep 22, 2011 10:10
Vote:
 

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>

#53773
Sep 22, 2011 13:33
Vote:
 

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>

#53868
Sep 23, 2011 12:11
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.