public XGrid() { InitializeComponent(); Initialize(); InitializeEvents(); _PrintableComponentLink.CreateReportHeaderArea += delegate(object sender, CreateAreaEventArgs e) { if (PrintHeader.IsNullOrEmpty() == false) { e.Graph.StringFormat = new BrickStringFormat(StringAlignment.Center); e.Graph.Font = new Font(SystemFonts.DefaultFont.FontFamily, 14f, FontStyle.Bold); var rect = new RectangleF(0, 0, e.Graph.ClientPageSize.Width, 50); e.Graph.DrawString(PrintHeader, Color.Black, rect, BorderSide.None); } }; _PrintableComponentLink.CreateReportFooterArea += delegate(object sender, CreateAreaEventArgs e) { if (PrintFooter.IsNullOrEmpty() == false) { e.Graph.StringFormat = new BrickStringFormat(StringAlignment.Near); e.Graph.Font = new Font(SystemFonts.DefaultFont.FontFamily, 10f, FontStyle.Regular); var rect = new RectangleF(0, e.Graph.ClientPageSize.Height - 50, e.Graph.ClientPageSize.Width, 50); e.Graph.DrawString(PrintHeader, Color.Black, rect, BorderSide.None); } }; _GridView.PopupMenuShowing += GridViewPopupMenuShowing; _BandedGridView.PopupMenuShowing += BandedGridViewPopupMenuShowing; _AdvBandedGridView.PopupMenuShowing += BandedGridViewPopupMenuShowing; GridLocalizer.Active = new KoreanGridLocalizer(); Grid.DataSourceChanged += delegate(object sender, EventArgs e) { DataSourceChanged?.Invoke(sender, e); }; }
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); } }
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; } }
/// <summary> /// A method for getting the header hieght. It is recommended to use this method instead of the just the Property for the Header object /// because when printing we are working out size the scope of the visual automatic update tree, so this guarentees the size returned /// has been recalculated and is up to date. /// </summary> /// <returns>Height of Header</returns> public double GetHeaderHeight() { PrintHeader.Measure(new Size(double.MaxValue, double.MaxValue)); return(PrintHeader.DesiredSize.Height); }