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?
Table: ASP.NET table and its Helper Control Classes. Manages a collection of table cells such as adding a cell to a row or removing a cell from it. CONTROL. CODE. DESCRIPTION.
Definition and Usage. The <table> tag defines an HTML table. An HTML table consists of one <table> element and one or more <tr>, <th>, and <td> elements. The <tr> element defines a table row, the <th> element defines a table header, and the <td> element defines a table cell.
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>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With