c#后台动态创建了htmltable,取其innerHtml时,会报错,因为,htmltable控件不支持该属性,要获取其innerHtml使用如下方法
HtmlTable tb=new HtmlTable(); StringBuilder sb = new StringBuilder(); StringWriter sw = new System.IO.StringWriter(sb); System.Web.UI.HtmlTextWriter htw = new HtmlTextWriter(sw); tb.RenderControl(htw); sb.tostring();
sb.tostring();即所需的innerHtml