This is a migrated thread and some comments may be shown as answers.

send a grid by email

0 Answers 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
vairam
Top achievements
Rank 1
vairam asked on 20 May 2008, 01:52 PM
Hi 
 I need to send a grid by email attachment  in excel or pdf fomat.

I have found some thing in telerik forum how to send a report by email likewise i need to send a grid by email.

        void MailReport(Telerik.Reporting.Report report, string from, string to, string subject, string body)
        {
            string mimeType;
            string extension;
            Encoding encoding;

            byte[] reportBytes =
                ReportProcessor.Render("PDF", report, null, out mimeType, out extension, out encoding);
          
            MemoryStream ms = new MemoryStream(reportBytes);
            ms.Position = 0;
           
            Attachment attachment = new Attachment(ms, report.Name + "." + extension);
            MailMessage msg = new MailMessage(from, to, subject, body);
            msg.Attachments.Add(attachment);
            SmtpClient client = new SmtpClient(smptHost);
            client.Send(msg);                       
        }

No answers yet. Maybe you can help?

Tags
Grid
Asked by
vairam
Top achievements
Rank 1
Share this question
or