页面添加代码如下:
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <table id="table1" runat="server" class="style1" border="1">
            <tr>
                <td id="Row1" runat="server" onclick="Text1.value=(this.id)">
                    &nbsp;</td>
            </tr>
            <tr>
                <td id="Row2" runat="server" onclick="Text1.value=(this.id)">
                    &nbsp;</td>
            </tr>
            <tr>
                <td id="Row3" runat="server" onclick="Text1.value=(this.id)">
                    &nbsp;</td>
            </tr>
            <tr>
                <td id="Row4" runat="server" onclick="Text1.value=(this.id)">
                    &nbsp;</td>
            </tr>
        </table>
    
    </div>
        <input id="Text1" runat="server" type="text" onclick="return Text1_onclick()" />
        <asp:Button ID="Button1" runat="server" Text="Button" />
    </form>
    </body>
代码页如下
public partial class _7_3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        var p = (HtmlTableRow)this.FindControl(Text1.Value);
        if (p != null)
        {
            table1.Rows.Remove(p);
        }
    }
}但是运行后出现了System.Web.UI.HtmlControls.HtmlTableCell”的对象强制转换为类型“System.Web.UI.HtmlControls.HtmlTableRow”。