protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                // Put user code to initialize the page here
                DataSet dsExport = (DataSet)Session["MyDataSet"];
                if (dsExport == null)
                {
                    Response.Write("Your session has timed out. Please re-submit the page");
                    return;
                }
                DataView dv1 = dsExport.Tables[0].DefaultView;
                //DataView dv2 = dsExport.Tables[1].DefaultView;
                //CHG0109406 - CH1 - BEGIN - Added below code to hide/display lblHeaderTimeZone to display the timezone
                string rptType = (string)Session["MyReportType"];
                if (rptType.Equals("2"))
                {
                    lblHeaderTimeZone.Visible = true;
                }
                else
                {
                    lblHeaderTimeZone.Visible = false;
                }
                //CHG0109406 - CH1 - END - Added below code to hide/display lblHeaderTimeZone to display the timezone
                if (Request.QueryString["type"] == "XLS")
                {
                    Response.ContentType = "application/vnd.ms-excel";
                    Response.Charset     = ""; //Remove the charset from the Content-Type header.
                }

                Page.EnableViewState = false;                 //Turn off the view	state.

                MSCR.Controls.PrintHeader PrintHeader;
                PrintHeader = (MSCR.Controls.PrintHeader)FindControl("PrintHeader");
                PrintHeader.DataBind();

                if (dsExport.Tables[0].Rows.Count > 0)
                {
                    dgReport1.DataSource = dv1;
                    dgReport1.DataBind();

                    //dgReport1.RenderControl(hw);
                }
                //if (dsExport.Tables[1].Rows.Count > 0)
                //{

                //    dgReport2.DataSource = dv2;
                //    dgReport2.DataBind();
                //    //dgReport2.RenderControl(hw);
                //}
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
示例#2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                // Put user code to initialize the page here
                DataSet dsExport = (DataSet)Session["MyDataSet"];
                if (dsExport == null)
                {
                    Response.Write("Your session has timed out. Please re-submit the page");
                    return;
                }

                DataView dv = dsExport.Tables[0].DefaultView;

                string erpt = (string)Session["MyReportType"];
                string csrs = (string)Session["CSRs"];

                Session["ProductName"] = Session["RevenueName"] = Session["AppName"] = null;

                MSCR.Controls.PrintHeader PrintHeader;
                PrintHeader = (MSCR.Controls.PrintHeader)FindControl("PrintHeader");
                PrintHeader.DataBind();

                Response.ContentType = "application/vnd.ms-excel";
                Response.Charset     = "";             //Remove the charset from the			Content-Type header.
                Page.EnableViewState = false;          //Turn off the view	state.

                if (erpt == "4" || erpt == "10")
                {
                    dgGrid.DataSource = dv;
                    dgGrid.DataBind();
                }
                else if (erpt == "5" || erpt == "11")
                {
                    dgGrid1.DataSource = dv;
                    dgGrid1.DataBind();
                }
                else
                {
                    dgGrid2.DataSource = dv;
                    dgGrid2.DataBind();
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                //Response.Write("Please try clicking the submit button and loading the report again. If that doesn't work , try closing the browser and run the report again.");
                //throw;
            }
        }