Search code examples
asp.netvb.netcode-behind

Removing all of the the headers and rows of an ASP.Net asp:Table that was populated at run time


We would like to remove all of the the headers and rows of an ASP.Net asp:Table that was populated at run time and is now currently being displayed on a web form.

Can this be done?

Please show code-behind coding that will do this if it can be done.


Solution

  • Are you looking for TableRowCollection.Clear?

    table.Rows.Clear()
    

    This will remove all TableRows (incl. TableHeaderRow and TableFooterRow) from the table.