How can I get separate NamingContainers for different asp:Panel server controls?

In the following .aspx markup, I see that:

<asp:Panel runat="server" ID="Case1" CssClass="caseEvaluationContainer">
     <asp:Label ID="NamingContainer1" Text=<%# Case1.NamingContainer.UniqueID %> Runat="server"></asp:Label>
     <br />
     <asp:Label ID="UniqueID1" Text="<%# Case1.UniqueID %>" Runat="server"></asp:Label>
</asp:Panel>


<asp:Panel runat="server" ID="Case4" CssClass="caseEvaluationContainer">
     <asp:Label ID="NamingContainer4" Text=<%# Case1.NamingContainer.UniqueID %> runat="server"></asp:Label>
     <br />
     <asp:Label ID="UniqueID4" Text="<%# Case1.UniqueID %>" runat="server"></asp:Label>
</asp:Panel>

The UniqueIDs are shown to be different, but not the NamingContainers.

How can I get something like the following to work (I need controls with the same ID's on the page without using a separate databinding containers like asp:Repeater or asp:FormView.

<asp:Panel runat="server" ID="TestPanel1">
    <asp:TextBox runat="server" ID="SameControlID"></asp:TextBox>
</asp:Panel>
<asp:Panel runat="server" ID="TestPanel2">
    <asp:TextBox runat="server" ID="SameControlID"></asp:TextBox>
</asp:Panel>

Related posts

Recent Viewed