How to send a web form page by mail??? RRS feed

  • Question

  • Hi all,

    I want to create a sample web page with ASP.NET containing 2 textbox (tbName, tbSurname) and 1 button (btSend). At here, user fill in the textbox with his name and surname and press Send button. After that his name and surname are stored in a dataset (NOT database). Until this point, there is no problem. But, I want to create a report from this data using this datatable and send it by mail in ASP.NET web application. Therefore, could you help me please how can I create a pdf report from Dataset and send it as an e-mail attachment?

    Thank in advance...
    Wednesday, April 7, 2010 5:19 PM

All replies

  • Hi Jahnsen,

    1. Create an RDLC report based on your dataset, then make sure you can display it in the ReportViewer. Take a look at this walkthrough for how-to.

    2. Once your report is properly displayed, use ReportViewer1.LocalReport.Render("PDF", ...). This thread has the code you need.

    3. Send it in email. KB314201 has sample VB.NET code. (The thread in 2 also contains pointers for doing this.)

    4. Once you can do this, you can try doing it without actually having the ReportViewer control on your page by using a LocalReport object directly. You just need to specify LocalReport.ReportPath and add your dataset as a ReportDataSource to LocalReport.DataSources.

    Cephas Lin This posting is provided "AS IS" with no warranties.
    Thursday, April 8, 2010 2:37 PM