日期:2011-09-28 浏览次数:20436 次
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;
}