我的控件的RenderContents方法中有以下c#代码。我如何添加外部CSS文件中的样式/类?如何在.net中动态添加CSS样式/类到HtmlTextWriterTag.Td?
output.AddAttribute(HtmlTextWriterAttribute.Border, "0");
output.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
output.RenderBeginTag(HtmlTextWriterTag.Table);
output.RenderBeginTag(HtmlTextWriterTag.Tbody);
output.RenderBeginTag(HtmlTextWriterTag.Tr);
//Here -> Need to add some style from external stylesheet.css file
output.RenderBeginTag(HtmlTextWriterTag.Td);
rblLoadSelection.RenderControl(output);
output.RenderEndTag(); //Td
output.RenderEndTag(); //Tr
output.RenderEndTag(); //Tbody
output.RenderEndTag(); //Table
我想他想添加一个样式,或类属性的TD元素,而不是一个样式表(我认为)的链接。 – CodingGorilla 2011-03-04 18:10:03
是的,我只需要为TD添加一个样式/类。对不起,不清楚。 – 2011-03-04 19:06:34