ReportViewer 多次加载一个嵌套在自身中的 rdlc
ReportViewer load one rdlc nested in itself many times
我有一个带有报表查看器控件的 asp.net 网络表单。我在单击页面上的按钮时将数据绑定到它。加载时,其中显示了多个 rdlc,我也只有一个!
这是我的 html 代码:
<section class="panel" aria-multiline="False">
<header class="panel-heading hcont headert T12">
<div class="TestAlignCenter">
<asp:ScriptManager ID="ScriptManager2" runat="server"></asp:ScriptManager>
<div id="Div3" visible="false" runat="server" class="TestAlignCenter" style="width: 90%; overflow: auto; border: 1px solid #000">
<rsweb:ReportViewer ID="ReportViewer2" Enabled="false" runat="server" DocumentMapWidth="100%" ClientInstanceName="ReportViewer1" ClientIDMode="Inherit" ShowFindControls="False" Width="100%" Height="1300px" ZoomMode="PageWidth" ShowPrintButton="true" AsyncRendering="false" SizeToReportContent="true" ShowRefreshButton="False">
</rsweb:ReportViewer>
</div>
</div>
</header>
</section>
这是我页面背后的代码:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DivisionCodesdt =objPermision.Dal_UserZonesForContract(Convert.ToInt32(HttpContext.Current.Session["ContractID"]));
for (int i = 0; i < DivisionCodesdt.Rows.Count; i++)
selectDivisions.Items.Add(new ListItem(DivisionCodesdt.Rows[i][0].ToString()));
}
}
protected void cmdShowReport_Click(object sender, EventArgs e)
{
if (selectDivisions.Value != null)
{
this.BindReport(selectDivisions.Value);
}
}
protected void BindReport(string DivisionCode)
{
DAL.Dal_Class_Contract objContract = new DAL.Dal_Class_Contract();
ReportingDataSet ds = new ReportingDataSet();
ds = objContract.Dal_Report_PersonelPresence(DivisionCode);
ReportDataSource rds = new ReportDataSource("ReportingDataSet", ds.Tables["DataTablePersonelPresence"]);
if (ds.Tables["DataTablePersonelPresence"].Rows.Count > 0)
{
ReportViewer1.Enabled = true;
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/RDLC/Report_PersonelPresence.rdlc");
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
}
}
结果是:
enter image description here
数据是真实的并且 rdlc 加载但是它嵌套了另一个 rdlc 副本!!!
我真的有麻烦了。有人可以帮我求情吗?
问题解决了!
我在页面上删除了这行代码:
<link href="css/TableResponsive.css" rel="stylesheet" />
好像有冲突。但我不知道原因。
我有一个带有报表查看器控件的 asp.net 网络表单。我在单击页面上的按钮时将数据绑定到它。加载时,其中显示了多个 rdlc,我也只有一个! 这是我的 html 代码:
<section class="panel" aria-multiline="False">
<header class="panel-heading hcont headert T12">
<div class="TestAlignCenter">
<asp:ScriptManager ID="ScriptManager2" runat="server"></asp:ScriptManager>
<div id="Div3" visible="false" runat="server" class="TestAlignCenter" style="width: 90%; overflow: auto; border: 1px solid #000">
<rsweb:ReportViewer ID="ReportViewer2" Enabled="false" runat="server" DocumentMapWidth="100%" ClientInstanceName="ReportViewer1" ClientIDMode="Inherit" ShowFindControls="False" Width="100%" Height="1300px" ZoomMode="PageWidth" ShowPrintButton="true" AsyncRendering="false" SizeToReportContent="true" ShowRefreshButton="False">
</rsweb:ReportViewer>
</div>
</div>
</header>
</section>
这是我页面背后的代码:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DivisionCodesdt =objPermision.Dal_UserZonesForContract(Convert.ToInt32(HttpContext.Current.Session["ContractID"]));
for (int i = 0; i < DivisionCodesdt.Rows.Count; i++)
selectDivisions.Items.Add(new ListItem(DivisionCodesdt.Rows[i][0].ToString()));
}
}
protected void cmdShowReport_Click(object sender, EventArgs e)
{
if (selectDivisions.Value != null)
{
this.BindReport(selectDivisions.Value);
}
}
protected void BindReport(string DivisionCode)
{
DAL.Dal_Class_Contract objContract = new DAL.Dal_Class_Contract();
ReportingDataSet ds = new ReportingDataSet();
ds = objContract.Dal_Report_PersonelPresence(DivisionCode);
ReportDataSource rds = new ReportDataSource("ReportingDataSet", ds.Tables["DataTablePersonelPresence"]);
if (ds.Tables["DataTablePersonelPresence"].Rows.Count > 0)
{
ReportViewer1.Enabled = true;
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/RDLC/Report_PersonelPresence.rdlc");
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
}
}
结果是: enter image description here
数据是真实的并且 rdlc 加载但是它嵌套了另一个 rdlc 副本!!! 我真的有麻烦了。有人可以帮我求情吗?
问题解决了! 我在页面上删除了这行代码:
<link href="css/TableResponsive.css" rel="stylesheet" />
好像有冲突。但我不知道原因。