Inherited GridView and XHTML validation errors

Mark Brackett <[email protected]> Tue, 7 Aug 2007 17:18:12 -0400
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <[email protected]>
If I inherit from GridView, and then use the inherited control like:
<c:MyGridView ID="myGridView" runat="server">
        <Columns>
                <asp:TemplateField>
                        <ItemTemplate>
                                <asp:Label ID="lbl1" runat="server" />
                        </ItemTemplate>
                        <EditItemTemplate>
                                <asp:Label ID="lbl1" runat="server" />
                        </EditItemTemplate>
                </asp:TemplateField>
        </Columns>
</c:MyGridView>

I will get the "Another object on this page already uses ID 'lbl1'"
validation (XHTML 1.1) error. However, if I change <c:MyGridView> to
<asp:GridView>, VS2005 seems to know that ItemTemplate and
EditItemTemplate are mutually exclusive (same deal with multiple
GridViews/MyGridViews - only, I assume it's because they're
INamingContainers).

Is there an attribute or something I can apply to my inherited GridView
that will get VS to treat it the same? Reflector doesn't see any obvious
ones on GridView....

--Mark Brackett

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com