Difference between HtmlTable and TagBuilder ("table")

Just wondering what the difference between the two is and what the benefit for one or the other of them will be when I create my table in my HtmlHelper

HtmlTable table = new HtmlTable();

and

TagBuilder table = new TagBuilder("table");

This is more or less the same as this question,

Why use TagBuilder instead of StringBuilder?

but I’m interested in learning about the difference between the two.

+3
source share
1 answer

, HtmlTable HTML <table> (, Width, Height, CellSpacing ..). Rows, HtmlTableRow, <tr>.

TagBuilder - API, , , HTML <table>, .

, HmlTable , TagBuilder width="" <table>.

HtmlTable:

HtmlTable htmlTable = new HtmlTable();
htmlTable.Width = "100px";

TagBuilder:

TagBuilder tagBuilder = new TagBuilder("table");
tagBuilder.Attributes["width"] = "100px";

, TagBuilder table, Width , ( ), HtmlTable.

+5

Source: https://habr.com/ru/post/1750074/


All Articles