Class PlaceholderPageContentConnector is used to connect the technological scripts and styles necessary to operate the controls and runtime using the controls-placeholders. This method allows you to configure your application more flexible by adding application code before/after the technological and user.
Is an alternative method of connection resources FilterPageContentConnector.
working Principle
Connect resources is by handling events of the beginning of rednering page (PreRenderComplete):
- in the collection of controls on the page (including Master page) are the controls with the following IDs:
FlexberryScriptsis a placeholder for the connection скриптов;FlexberryStylesis a placeholder for the connection стилей;FlexberryRawHtmlis a placeholder for the connection of special technological элементов;
- the collection of placeholders controls are added controls that connect resources.
If controls are found, an exception will be raised.
Warning: due To the fact that the resources are connected in
PreRenderComplete the elements connected after will not be added to the markup.Setting
1.To connect resources based on the placeholders you want to configure unity (web.config):
<register type="NewPlatform.Flexberry.Web.Http.IPageContentConnector, NewPlatform.Flexberry.Web.Http"
mapTo="NewPlatform.Flexberry.Web.Http.PlaceholderPageContentConnector, NewPlatform.Flexberry.Web.Http" />
2.In the page layout / Master page you need to add controls-placeholders:
<asp:Placeholder ID="FlexberryStyles" runat="server" />
<asp:Placeholder ID="FlexberryScripts" runat="server" />
<asp:Placeholder ID="FlexberryRawHtml" runat="server" />
Note: a Placeholder
FlexberryStyles usually added in the <head> of the page. Warning: the placeholder
FlexberryScripts affect the correct operation of custom scripts added to the page in ContentPlaceHolder0. FlexberryScripts should be placed higher in the markup. Note: when manually added FlexberryScripts, the data can still be connected to the end of the <body> tag (it should have an attribute
runat=server)!