hi,
I have panel and inside panel i have gridview and other controls as well.
I want to send panel content as email in c#
I have this code it is sending gridview as email, but i want to export all panel controls as email
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter hw = new HtmlTextWriter(sw))
{
DataView dview = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
SMTP = (string)dview.Table.Rows[0]["SMTP"];
BCC = (string)dview.Table.Rows[0]["BCC"];
Emailfrom = (string)dview.Table.Rows[0]["Emailfrom"];
Password = (string)dview.Table.Rows[0]["Password"];
GridView1.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
MailMessage mm = new MailMessage(Emailfrom.ToString(), BCC.ToString());
mm.Subject = "Order from Nature's Mix Date:"+ DateTime.Now.ToString("dd/MMM/yyyy");
mm.Body = "Details:<hr /> " + sw.ToString(); ;
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = SMTP.ToString();
smtp.EnableSsl = false; ;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = Emailfrom.ToString();
NetworkCred.Password = Password.ToString();
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 25;
smtp.Send(mm);
}
}