我有一个包含表格的用户控件(但不仅仅是一个表格)。我希望此控件接受表行(并且只有表行)作为子控件并将它们添加到表中:
MyTable.ascx
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="MyTable.ascx.vb" Inherits="MyTable" %>
<%-- Here are actually a bunch of other controls --%>
<asp:Table runat="server">
<%-- I want rows to be added here --%>
</asp:Table>
Test.aspx文件
<uc1:MyTable runat="server" ID="MyTable1">
<asp:TableRow>
<asp:TableCell>Foo</asp:TableCell>
<asp:TableCell>Bar</asp:TableCell>
</asp:TableRow>
</uc1:MyTable>