Hi Russ,
As for getting the output html of a webcontrol, the code you used is
correct , just one thing missed. We need to use a StringBuilder to
construct the StringWriter and after rendering the control into the
HtmlTextWriter, we cna get the control's output in the StringBuilder. For
example:
=========================================
Table tb = new Table();
tb.ID = "tbl";
tb.Rows.Add(new TableRow());
tb.Rows.Add(new TableRow());
tb.Rows[0].Cells.Add(new TableCell());
tb.Rows[1].Cells.Add(new TableCell());
System.Text.StringBuilder sb = new System.Text.StringBuilder();
System.IO.StringWriter sw = new System.IO.StringWriter(sb);
HtmlTextWriter htw = new HtmlTextWriter(sw);
tb.RenderControl(htw);
Response.Write("<br>" + HttpUtility.HtmlEncode(sb.ToString()));
htw.Close();
sw.Close();
==================================
In addition, it is ok to retrieve the outputhtml of a control, however,
haven't means to easiliy replace the ouput which will be rendered in the
page. If you want to make some customizing on the control's output, it's
better that we override the control. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx