Я хочу написать обычный тег-тег для таблицы div и встроенной таблицы стилей CSS. встроенная таблица стилей CSS может уменьшить дублирование класса HTML. результат будет выглядеть следующим образом:
<head>
<style id='styleblockid'>
.g1{border-left:1px solid Silver}
.g2{border-left:3px solid green}
....
.g100{border-left:2px solid red}
</head>
<body>
<div>
<table>
<tbody>
<tr>
<td class="g2"></td>
</tr>
<tr>
<td class="g2"></td>
</tr>
..........
<tr>
<td class="g1"></td>
</tr>
</tbody>
</table>
</div>
На странице .cshtml будет написан код, подобный этому
<mytable color="red" basename="hello" event="click"></mytable>
//using the asp.net core taghelper
//use targetelment can have context helper for mytable for customers
[HtmlTargetElement("mytable", Attributes = "color, basename,event"))]
public class GridWebTagHelper : TagHelper
{
public override void Process(TagHelperContext context, TagHelperOutput output)
{
//styleblock will build the style part
String styleblock="";
//divhtml will build the div part
String divhtml="";
output.TagName = "div";
.....
//here skip the code which build the styleblock and the divhtml
......
output.Content.AppendHtml(divhtml);
base.Process(context, output);
}
}
С помощью основного тега asp.net я могу отобразить только часть div. Как мне отрендерить стилевую часть в том же процессе?