Last post Aug 07, 2009 04:33 AM by Allen Chen – MSFT
Aug 05, 2009 06:21 PM|snives|LINK
I have a CompositeControl called Pager that pages a collection of images and it adds two linkbuttons a "Next" and "Prev" for moving forward/back etc. PersistChildren(true) ParseChildren(false) Implementation looks like this:
<cc1:pager ID="Pager" PageSize="16" runat="server" FooterVisible="true" >
<asp:Repeater ID="PhotoRepeater1" runat="server">
<img src='<%# DataBinder.Eval(Container, "DataItem.UrlSmall") %>' />
So in Pager.CreateChildControls() I create my two LinkButtons and add them to Controls.
Then I override Pager.RenderContents and call RenderChildren(writer).
Works fine my LinkButtons appear first and then the output from the repeater appears. But I would like to have the LinkButtons output after the repeaters output. So far I haven't found out how to change the order of rendering so I can render the inner
controls first and *then* render my nested controls.
I can probably hack the RenderEndTag up and create my controls there, but im pretty sure thats wrong. For example, what if I was writing an adapter and I needed to adjust what the children controls had output, how would you do that? I think the answer
to both these questions probably use the same technique but I haven't seen any examples of anyone doing this.
Aug 07, 2009 04:33 AM|Allen Chen – MSFT|LINK
You can add it in:
protected override void OnPreRender(EventArgs e)
//add controls here