Hi,
you can use the following method. This will work for all aspx pages(which includes any asp.net controls)
private string GetHTMLContent()
{
StringWriter sw = new StringWriter();
HtmlTextWriter w = new HtmlTextWriter(sw);
divHTMLWrapper.RenderControl(w);
string htmlString = sw.GetStringBuilder().ToString();
}
// You must declare this function in the code file
public override void VerifyRenderingInServerForm(Control control)
{
}
The aspx page will look like this. Your aspx controls should be in "divHTMLWrapper"
<form id="form1" runat="server">
<pre lang="xml">
<div id="divHTMLWrapper" runat="server">
<div style="width: 100%; background-position: center center;">
<div style="margin:auto; width:280px">
<img runat="server" src="images/logo_new.jpg" style="text-align:center" /></div>
</div>
</div
</form>