I'm trying to display a report, but when I pass the parameters via code it does not load the report, if I let it open the browser and pass the parameters at runtime it works normally.
Report Viewer code:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" Height="615px" ProcessingMode="Remote" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Width="820px">
<ServerReport ReportPath="/Compras/Pedido" ReportServerUrl="http://srv-teste/ReportServer" />
</rsweb:ReportViewer>
<div>
</div>
</form>
Code-Behind:
protected void Page_Load(object sender, EventArgs e)
{
Microsoft.Reporting.WebForms.ReportParameter p1 = new Microsoft.Reporting.WebForms.ReportParameter("idFornecedor", "23");
Microsoft.Reporting.WebForms.ReportParameter p2 = new Microsoft.Reporting.WebForms.ReportParameter("idPedido", "23");
Microsoft.Reporting.WebForms.ReportParameter p3 = new Microsoft.Reporting.WebForms.ReportParameter("idPedidoCabecalho", "23");
Microsoft.Reporting.WebForms.ReportParameter p4 = new Microsoft.Reporting.WebForms.ReportParameter("idobra", "23");
Microsoft.Reporting.WebForms.ReportParameter p5 = new Microsoft.Reporting.WebForms.ReportParameter("idFat", "23");
Microsoft.Reporting.WebForms.ReportParameter p6 = new Microsoft.Reporting.WebForms.ReportParameter("idMaterial", "23");
this.ReportViewer1.ServerReport.SetParameters(p1);
this.ReportViewer1.ServerReport.SetParameters(p2);
this.ReportViewer1.ServerReport.SetParameters(p3);
this.ReportViewer1.ServerReport.SetParameters(p4);
this.ReportViewer1.ServerReport.SetParameters(p5);
this.ReportViewer1.ServerReport.SetParameters(p6);
}
When I comment on the lines of Page_Load it works normally.