Advertisement
Guest User

Untitled

a guest
Feb 15th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. StringBuilder sb = new StringBuilder();
  2. string MailSturcture;
  3.  
  4. using (System.IO.StringWriter sw = new StringWriter())
  5. {
  6. using (HtmlTextWriter hw = new HtmlTextWriter(sw))
  7. {
  8. gvDaySummary.RenderControl(hw);
  9. hw.WriteBreak();
  10. BarChart1.RenderControl(hw);
  11.  
  12. System.IO.StringReader sr = new StringReader(sw.ToString());
  13.  
  14. MailMessage mail = new MailMessage();
  15. mail.From = new MailAddress("noreply@xxx.com", "aura");
  16. mail.To.Add("abc@xxx.com");
  17.  
  18. mail.Subject = "Daily Payment Summary";
  19. mail.IsBodyHtml = true;
  20. sb.AppendFormat(sw.ToString());
  21.  
  22. MailSturcture = sb.ToString();
  23. mail.Body = MailSturcture;
  24.  
  25. System.Net.Mail.SmtpClient smtp = new SmtpClient();
  26. smtp.Host = "smtpout.secureserver.net";
  27. smtp.Port = 80;
  28. System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
  29. NetworkCred.UserName = "abc@xxx.com";
  30. NetworkCred.Password = "xxx";
  31. smtp.UseDefaultCredentials = true;
  32. smtp.Credentials = NetworkCred;
  33. smtp.EnableSsl = false;
  34. smtp.Send(mail);
  35. }
  36. }
  37.  
  38. public override void VerifyRenderingInServerForm(System.Web.UI.Control control)
  39. {
  40. /* Verifies that the control is rendered */
  41. }
  42.  
  43. Script control 'BarChart1' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
  44. Parameter name: scriptControl
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement