Example #1
0
        protected void ddlSupplier_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            if (ddlSupplier.SelectedIndex > 0)
            {
                objReportBiz = new ReportBiz();
                ReportDocument     rd       = new ReportDocument();
                CompanyInformation objClass = new CompanyInformation();

                DataTable dt = new DataTable();
                dt = objReportBiz.SupplierwisePurchaseDetails(ddlSupplier.SelectedValue);
                rd.Load(Server.MapPath("SupplierwisePurchaseDetail.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);
            }
        }