Hi I'm having a bit of a nightmare here!
I'mv trying output a webform to html using page.rendercontrol and htmltextwriter but it is resulting in a blank email.
Code:
   StringBuilder sb = new StringBuilder();
   StringWriter sw = new StringWriter(sb);
   HtmlTextWriter htmlTW = new HtmlTextWriter(sw);
   page.RenderControl(htmlTW);
   String content = sb.ToString();
   MailMessage mail = new MailMessage();
   mail.From = new MailAddress("test@test.com");
   mail.To.Add("steve@test.com");
   mail.IsBodyHtml = true;
   mail.Subject = "Test";
   mail.Body = content;
    SmtpClient smtp = new SmtpClient("1111");
    smtp.Send(mail);
    Response.Write("Message Sent");
I also tried it by rendering a single textbox and got and error saying It needed to be within form tags (which are on the masterpage).
I tried this fix: http://forums.asp.net/p/1016960/1368933.aspx#1368933 and added:
public override void 
VerifyRenderingInServerForm(Control control) { return; }
But now the errror I get is:
VerifyRenderingInServerForm(Control)': no suitable method found to override
Does anyone have a fix for this? I'm tearing my hair out!!
Thanks,
Steve
 
     
     
     
     
     
    