asp.net|控件
X将Asp.net 控件的呈现html获取,在不少场合会用到,比如生成静态页时
以下代码选自 Asp.net 2.0 高级编程
public static string RenderControlAsString(Control ctl)...{
StringWrite sw=new StringWrite();
HtmlTextWrite write=new HtmlTextWrite(sw);
ctl.RenderControl(writer);
string str =sw.ToString();
write.Close();
sw.Close();
return str;
}
时间: 2024-10-29 05:48:33