有没有办法使用 HtmlTextWriter 创建它?我正在尝试创建一种在服务器端动态创建 html 的方法
<fieldset class='ui-grid-a' data-theme='c'>
这是代码的开始,我不确定如何创建“数据主题”属性,因为没有为此提供枚举..
// Initialize StringWriter instance.
StringWriter stringWriter = new StringWriter();
// Put HtmlTextWriter in using block because it needs to call Dispose.
using (HtmlTextWriter writer = new HtmlTextWriter(stringWriter))
{
foreach (string employee in myList)
{
writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);
writer.AddAttribute(HtmlTextWriterAttribute.Class, "ui-grid-a");
writer.AddAttribute(HtmlTextWriterAttribute., "ui-grid-a");
}
}