【问题标题】:RDLC Report loads only on page load but not button click eventRDLC 报告仅在页面加载时加载,而不是按钮单击事件
【发布时间】:2012-10-16 18:06:10
【问题描述】:

我是 asp.net 编程的新手,我想在每次单击按钮时在 reportviewer 中加载 rdlc 报告。问题是如果我在页面加载时调用 LoadReport 函数,报告会正确加载,但在加载报告时会出现问题单击按钮。它没有显示错误。我创建了 DataSet1.xsd 并将其附加到 rdlc 报告中,在另一个 aspx 页面中我填充了 DataSet1.xsd 并附加到 ReportDataSource()。它显示了数字列以及数据和它毫无错误地绑定到报告,但每当我看到 aspx 页面时它总是空白。请提供解决方案,因为它是我的优先任务。这是我的代码;

 private void LoadReport()
    {
GetData();



            ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/Report2.rdlc");
            ReportViewer1.ProcessingMode = ProcessingMode.Local;



            ReportDataSource rds = new ReportDataSource();
            rds.Name = "DataSet1";
            rds.Value = ds.DataTable1;          
            ReportViewer1.LocalReport.DataSources.Clear();
            ReportViewer1.LocalReport.DataSources.Add(rds);
            ReportViewer1.DataBind();
            LocalizeReport(ReportViewer1.LocalReport);

            ReportViewer1.LocalReport.Refresh();
            ReportViewer1.Visible = true;
}

 private void GetData()
    {


            DataSet1.DataTable1Row dr = ds.DataTable1.NewDataTable1Row();

            dr[0] = "abc";
            dr[1] = "49/Male";
            dr[2] = "21656";
            dr[3] = " ";
            dr[4] = " ";
            dr[5] = " ";
            dr[6] = " ";
            dr[7] = " ";
            dr[8] = " ";
            dr[9] = " ";
            dr[10] = "abc";
            dr[11] = "ccvc";
            dr[12] = "abc";
            dr[13] = " ";
            dr[14] = " ";
            dr[15] = "abc ";
            dr[16] = " ";            
            ds.DataTable1.AcceptChanges();

            ds.DataTable1.AddDataTable1Row(dr);

        }

    }

【问题讨论】:

    标签: c# asp.net rdlc dynamic-rdlc-generation


    【解决方案1】:

    使用触发器.....

    enter code here <asp:UpdatePanel ID="Report_UP" runat="server">
        <ContentTemplate>
        </ContentTemplate>
         <Triggers> 
             <asp:PostBackTrigger ControlID="SubmitButton"/>        
         </Triggers>         
    </asp:UpdatePanel>
    

    它对我有用,希望它对你有用....

    【讨论】:

      猜你喜欢
      • 2011-04-07
      • 1970-01-01
      • 2011-04-10
      • 1970-01-01
      • 2014-04-29
      • 2016-10-01
      • 2014-02-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多