我有一个带有reportviewer控件的asp.net Web表单。我点击页面上的按钮将数据绑定到它。当它加载时,它中显示了多个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的另一个副本! 我真的遇到了麻烦。有人可以帮我请求吗?
答案 0 :(得分:0)
问题解决了! 我在页面上删除了这行代码:
<link href="css/TableResponsive.css" rel="stylesheet" />
这似乎是一场冲突。但我不知道里昂。