What are the differences between the ASP.Net control <asp:Table> compared to the old reliable table HTML implementation?
I know that the <asp:Table> will end up on the returned page as a HTML table, but does the ASP.Net control come with any benefits that I’m missing?
A “regular”
<table>is not available for modification at all on the server side. As far as the server-side is concerned, it’s just static text that gets output to the browser.I would say that as a general rule, favour
<table>unless you explicitly need to modify the structure of the table on the server. Using<asp:Table>means you have the overhead of running the code-behind for the table, generating the server-side control and so on. If you’re not using any of that functionality, then there’s no point.Also, in general,
<asp:DataTable>is typically more useful than just plain<asp:Table>, since it supports data-binding and so on.Usually, if I just want to show/hide a single row in a table (or something) then I’ll just put
runat="server"on the single<tr>that I want to control, rather than using a whole<asp:Table>.