Example #1
0
        protected void btnSearch_OnClick(object sender, EventArgs e)
        {
            objReportBiz = new ReportBiz();
            ReportDocument     rd       = new ReportDocument();
            CompanyInformation objClass = new CompanyInformation();

            DataTable dt = new DataTable();

            dt = objReportBiz.InvoicewisePurchaseDetails(txtInvoiceNumber.Text.Trim());
            rd.Load(Server.MapPath("InvoicewisePurchaseDetail.rpt"));

            //Property for Header And Footer - Start

            TextObject txtCompanyName = rd.ReportDefinition.ReportObjects["txtCompanyName"] as TextObject;

            txtCompanyName.Text = objClass.txtCompanyName;

            TextObject txtTradeLicense = rd.ReportDefinition.ReportObjects["txtTradeLicence"] as TextObject;

            txtTradeLicense.Text = objClass.txtTradeLicense;

            TextObject txtCompanyAddress = rd.ReportDefinition.ReportObjects["txtCompanyAddress"] as TextObject;

            txtCompanyAddress.Text = objClass.txtCompanyAddress;

            //Property for Header And Footer - End

            rd.SetDataSource(dt);

            Session["CrystalReport"] = rd;
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow",
                                                "window.open('../ReportViewer.aspx');", true);
        }