Search code examples
asp.netreportingrdlcreportviewerdynamic-rdlc-generation

ReportViewer load one rdlc nested in itself many times


I have a asp.net web form with a reportviewer control. I bind data to it as clicking a button on my page. when it loads, more than one rdlc is shown in it also I have only one! this is my html code:

<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>

and this is the code behind my page:

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);
        }

    }

result is: enter image description here

Data is true and rdlc loads but it nests another copy of rdlc!!! I am really in trouble. Can anybody help me pleas?


Solution

  • Problem Solved! I delete this line of code on page:

    <link href="css/TableResponsive.css" rel="stylesheet" />
    

    It seems like a conflict. but I don't know the reason.