What is the meaning of the TableHeaderRow class

I just converted the code using the HtmlTable controls to the Table web controls, and I found that in addition to the TableRow class, TableRow also a TableHeaderRow . I stupidly made the assumption, based on some of the comments read here, that if the string was one of them, it would be placed in the thead element in the HTML output. This is not true.

When this did not work, I TableHeaderRow look and noticed that TableHeaderRow apparently does not have any valid code on it and that the TableSection TableRow property TableRow not care if it is a TableHeaderRow or not.

So what is the essence of this type? It seems that in practice it is exactly identical to the TableRow class, and you still need to set the TableSection property for it to tell it that its string is thead .

Is there a good use case for this? Of course, I can’t think of one thing ...

Edit for clatification

In my research, I used Refactor to look at the involved code. This is how I determined that TableHeaderRow appears to derive from TableRow , but does not actually implement anythign new.

In rendering for Table when deciding whether to display thead or not, it seems to look clean in the TableSection property. I don't care what the actual type of string is, and I cannot find a single line of code anywhere where I look, which will behave differently solely from what type of string is different.

I am looking for a practical example of how it differs. Although I appreciate the links to the doc, they do not really match the code I'm looking at.

+4
source share
2 answers

I wondered the same thing. When I saw the Create an ASP.NET table title bar page, I realized that I was not setting the TableSection property as it should:

 hRow.TableSection = Web.UI.WebControls.TableRowSection.TableHeader 

This caused the <thead> element to appear in the output html.

+3
source

According to this MSDN record :

This class supports displaying tables on devices with a limited screen size. On these devices, a table with many columns and rows should be displayed on multiple pages. Adding a HeaderRow table to the control table allows you to specify a title bar that appears as the first row on each page that displays the table view.

I would conclude that TableRow does not provide such support.

+1
source

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


All Articles