Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use following code which generate pdf file in background as like on button click and then would popup in brwoser with SaveAs and cancel option.</p> <pre><code>Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty;`enter code here` string extension = string.Empty; DataSet dsGrpSum, dsActPlan, dsProfitDetails, dsProfitSum, dsSumHeader, dsDetailsHeader, dsBudCom = null; enter code here //This is optional if you have parameter then you can add parameters as much as you want ReportParameter[] param = new ReportParameter[5]; param[0] = new ReportParameter("Report_Parameter_0", "1st Para", true); param[1] = new ReportParameter("Report_Parameter_1", "2nd Para", true); param[2] = new ReportParameter("Report_Parameter_2", "3rd Para", true); param[3] = new ReportParameter("Report_Parameter_3", "4th Para", true); param[4] = new ReportParameter("Report_Parameter_4", "5th Para"); DataSet dsData= "Fill this dataset with your data"; ReportDataSource rdsAct = new ReportDataSource("RptActDataSet_usp_GroupAccntDetails", dsActPlan.Tables[0]); ReportViewer viewer = new ReportViewer(); viewer.LocalReport.Refresh(); viewer.LocalReport.ReportPath = "Reports/AcctPlan.rdlc"; //This is your rdlc name. viewer.LocalReport.SetParameters(param); viewer.LocalReport.DataSources.Add(rdsAct); // Add datasource here byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings); // byte[] bytes = viewer.LocalReport.Render("Excel", 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. // System.Web.HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Buffer = true; Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", "attachment; filename= filename" + "." + extension); Response.OutputStream.Write(bytes, 0, bytes.Length); // create the file Response.Flush(); // send it to the client to download Response.End(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload