0
I have the rdlc created, and have a page aspx
that has a print button, when clicking on print I want to call the rdlc I have created for printing. How do I?
0
I have the rdlc created, and have a page aspx
that has a print button, when clicking on print I want to call the rdlc I have created for printing. How do I?
0
The Print button should call another aspx. In this aspx, you can do as follows:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc");
var dsClientes = GetData("select top 20 * from clientes");
ReportDataSource datasource = new ReportDataSource("Clientes", dsClientes.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasource);
}
}
private Customers GetData(string query)
{
string conString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
SqlCommand cmd = new SqlCommand(query);
using (SqlConnection con = new SqlConnection(conString))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (Customers dsClientes = new Customers())
{
sda.Fill(dsClientes, "DataTable1");
return dsClientes;
}
}
}
}
Browser other questions tagged c# asp.net reportviewer report
You are not signed in. Login or sign up in order to post.
I saw this example, but here you will not find any reportview when typing
– War Lock
You added the component
ReportViewer1
in aspx as an example?– Leonel Sanches da Silva
this reportview refers to q? class?
– War Lock
Component
ReportViewer
, section Reporting of the component bar on the left. You have this part in the example.– Leonel Sanches da Silva
I just typed <rsweb:Reportviewer ID="Reportviewer1" runat="server" Width="600">
– War Lock
It worked here, I’ll test it
– War Lock