Placeholder not replaced
-
Hello, I use a placeholder in a normal table, to generate some columns dynamic. The table is a child of a repeater. A placeholder is in the tableheader and one placeholder in tablefooter. All of this has worked till I moved the repeater to a usercontrol for reusing this element more than once in one page. Here is the code:
<asp:repeater id="Rep_dn" runat="server" DataSource="<%# m_oView %>"> <HeaderTemplate> <table cellspacing="0" cellpadding="0" border="1"> <tr align="center" bgcolor=="#ecf5ff"> <th width="50px">Karton</th> <asp:placeholder ID="PH_sizeheaderK" Runat="server"></asp:placeholder> </tr> </HeaderTemplate> <ItemTemplate> <tr align="center" bgcolor="#fafafa"> <uc_k:PDNKUC id="PDNKUC" runat="server" carton_refid='<%# DataBinder.Eval (Container.DataItem, "carton_refid")%>' ph_sizeitem='<%# true%>' ></uc_k:PDNKUC> </tr> </ItemTemplate> <FooterTemplate> <tr align="center" bgColor="#ecf5ff"> <td align="right">Sum</td> <asp:placeholder ID="PH_sizefooterK" Runat="server"></asp:placeholder> </tr> </table> </FooterTemplate> </asp:repeater>
The placeholder in the insided usercontrol is filled via property ph_sizeitem. It works fine. The placeholders in header- and footertemplate is filled via function from codebehind like this:Dim oControl As System.Web.UI.Control Dim ph As PlaceHolder Rep_dn.DataBind() For Each oControl In Rep_dn.Controls() ph = oControl.FindControl("PH_sizeheaderK") If Not (ph Is Nothing) Then ph.Controls.Add(New LiteralControl(m_sHtmlHeader)) Exit For End If Next For Each oControl In Rep_dn.Controls()