Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void Print_Click(object sender, ImageClickEventArgs e)
- {
- IolaNetWeightWeb.BarTableAdapters.Product_Weight_Data_Sheet_QueryTableAdapter ds = new IolaNetWeightWeb.BarTableAdapters.Product_Weight_Data_Sheet_QueryTableAdapter();
- ReportDataSource rds = new ReportDataSource("Bar_Product_Weight_Data_Sheet_Query", ds.GetData(DropDownList1.Text, DropDownList3.Text));
- // Variables
- Warning[] warnings;
- string[] streamIds;
- string mimeType = string.Empty;
- string encoding = string.Empty;
- string extension = string.Empty;
- // Setup the report viewer object and get the array of bytes
- ReportViewer viewer = new ReportViewer();
- viewer.ProcessingMode = ProcessingMode.Local;
- viewer.LocalReport.ReportPath = "printonebartest1.rdlc";
- viewer.LocalReport.DataSources.Add(rds); // Add datasource here
- byte[] bytes = ReportViewer1.LocalReport.Render("Pdf", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
- // Now that you have all the bytes representing the PDF report, buffer it and send it to the client.
- Response.Buffer = true;
- Response.Clear();
- Response.ContentType = mimeType;
- Response.AddHeader("content-disposition", "inline; filename=PrintOneBar.pdf");
- Response.BinaryWrite(bytes); // create the file
- Response.Flush(); // send it to the client to download
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement