TagHelperContext carries information about the HTML element currently being transformed by an ASP.NET Core tag helper. The Process method receives it alongside TagHelperOutput, making it the helper’s view of the input element and its shared processing state. section 25.2.1
The context exposes three useful areas:
- AllAttributes provides a read-only dictionary of attributes applied to the element, indexed by name and position. section 25.2.1
- Items provides a dictionary for sharing values between tag helpers applied to an element and helpers applied to its descendants. section 25.3.6
- UniqueId supplies a unique identifier for the element being transformed. section 25.2.1
Passing a row theme to cells
A RowTagHelper stores its Theme value in context.Items["theme"]. A CellTagHelper checks that shared value and assigns a Bootstrap class to each th or td. A themed tr therefore configures its descendants without repeating the theme attribute on every cell. The view must define those th and td elements explicitly; tag helpers do not process elements generated by other tag helpers. section 25.3.6
