Asp.net 将行添加到用户控件内的表
我有一个用户控件,它包含一个表,而不仅仅是一个表。我希望此控件接受表行且仅接受表行作为子控件,并将它们添加到表中: MyTable.ascx Test.aspxAsp.net 将行添加到用户控件内的表,asp.net,web-user-controls,Asp.net,Web User Controls,我有一个用户控件,它包含一个表,而不仅仅是一个表。我希望此控件接受表行且仅接受表行作为子控件,并将它们添加到表中: MyTable.ascx Test.aspx 您是否尝试过设置属性public TableRow TableRowProperty{get;set;},这样会自动将子控件作为行添加到我的表中? <%@ Control Language="vb" AutoEventWireup="false" CodeBehind="MyTable.ascx.vb" Inherits="MyT
您是否尝试过设置属性public TableRow TableRowProperty{get;set;},这样会自动将子控件作为行添加到我的表中?
<%@ 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>
<uc1:MyTable runat="server" ID="MyTable1">
<asp:TableRow>
<asp:TableCell>Foo</asp:TableCell>
<asp:TableCell>Bar</asp:TableCell>
</asp:TableRow>
</uc1:MyTable>