c# - RDLC 报告不断加载而不显示数据

标签 c# reporting rdlc

我想通过手动将值填充到数据集来生成 rdlc 报告,因为我将日期作为输入发送到查询。 我使用以下代码来做到这一点

//my list get populated with the relevant records according to its date and I'm using the tableadapter of my dataset to do that

List<DailySalesEntity> list = DailySalesHandler.GetSalesByDate(dateTimePicker1.Value);
            reportViewer1.LocalReport.DataSources.Clear();
            Microsoft.Reporting.WinForms.ReportDataSource report = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet_Dailysales", list);
            reportViewer1.LocalReport.DataSources.Add(report);
            reportViewer1.LocalReport.Refresh();

. 我正在使用 Tablix 来使用数据集显示我的数据。我已将正确的报告设置为报告查看器。 我没有得到任何异常(exception)。但是报告一直在加载并且不显示报告。我做错了什么。

如何通过将参数传递给查询来填充数据集,并在报告中使用生成的数据集?

最佳答案

我刚遇到这个问题并解决了它。 加载标志一直显示并且从未消失。 在我的例子中,问题是我没有处理 IsPostBack 值。 LocalReport.Refresh() 生成一个回发,如果不处理,它会一直发布和发布。

这是我的问题。通过墙 Refrеsh 页面继续做 PostBacks

protected void Page_Load(object sender, EventArgs e)
{
    // Report data source code...
    myReport.LocalReport.Refresh();
}

解决方案:

protected void Page_Load(object sender, EventArgs e)
{
    if(!IsPostBack)
    {
        // Report data source code...
        myReport.LocalReport.Refresh();
    }
}

因此,请检查您是否正在处理 PostBack 而不是无限循环。

关于c# - RDLC 报告不断加载而不显示数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11049917/

相关文章:

C# - using 语句的位置

ms-access - 在 MS-Access 报告中模仿电子表格样式

crystal-reports - 仅显示在 Crystal 报告详细信息部分的第一行

c# - RDLC vs Crystal Reports vs Anything Else 免费 : I'm running Informix and using C# 4. 0

C# Base64 字符串可以转换为图像,但不显示在 .rdlc 图像控件中

c# - 平滑连接圆心

c# - RegistryKey.CreateSubKey 不适用于 Azure 托管环境

c# - Paypal Windows 8 结帐 SDK

python - Django 报告选项

c# - Visual Studio 2017 中的 Microsoft Rdlc 报表设计器