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;
}
新聞熱點
疑難解答
圖片精選