protected void SetPageNumberControl(GrapeCity.ActiveReports.SectionReportModel.TextBox pageNumberTextBox) { if (pageNumberTextBox != null) { pageNumberTextBox.SummaryRunning = SummaryRunning.All; pageNumberTextBox.SummaryType = SummaryType.PageCount; } }
private void ReportForm_Load(object sender, EventArgs e) { rpt = new SectionReport(); //Adding Page Header/Footer sections rpt.Sections.InsertPageHF(); rpt.Sections[0].BackColor = Color.LightGray; //Adding Detail section rpt.Sections.Insert(1, new Detail()); rpt.Sections[1].BackColor = Color.PeachPuff; rpt.Sections[1].Height = 0.5f; //Adding label to display first column's name GrapeCity.ActiveReports.SectionReportModel.Label lblCategoryID = new GrapeCity.ActiveReports.SectionReportModel.Label(); lblCategoryID.Location = new PointF(0, 0.05F); lblCategoryID.Text = "Tên món ăn"; lblCategoryID.Alignment = GrapeCity.ActiveReports.Document.Section.TextAlignment.Center; lblCategoryID.Font = new Font("Arial", 10, FontStyle.Bold); rpt.Sections[0].Controls.Add(lblCategoryID); //Adding label to display second column's name GrapeCity.ActiveReports.SectionReportModel.Label lblCategoryName = new GrapeCity.ActiveReports.SectionReportModel.Label(); lblCategoryName.Location = new PointF(1.459f, 0.05f); lblCategoryName.Size = new SizeF(1.094f, 0.2f); lblCategoryName.Text = "Giá"; lblCategoryName.Font = new Font("Arial", 10, FontStyle.Bold); rpt.Sections[0].Controls.Add(lblCategoryName); // Adding Textbox to display first column's records GrapeCity.ActiveReports.SectionReportModel.TextBox txtCategoryID = new GrapeCity.ActiveReports.SectionReportModel.TextBox(); txtCategoryID.Location = new PointF(0, 0); txtCategoryID.Alignment = GrapeCity.ActiveReports.Document.Section.TextAlignment.Center; rpt.Sections[1].Controls.Add(txtCategoryID); //Adding Textbox to display second column's records GrapeCity.ActiveReports.SectionReportModel.TextBox txtCategoryName = new GrapeCity.ActiveReports.SectionReportModel.TextBox(); txtCategoryName.Location = new PointF(1.459f, 0); rpt.Sections[1].Controls.Add(txtCategoryName); // Setting report's data source rpt.DataSource = DataProvider.Instance.ExecuteQuery("select * from dbo.menu where created ='" + _dateReport + "' "); // Assigning DataField properties of controls in the detail section txtCategoryID.DataField = "name"; txtCategoryName.DataField = "price"; rpt.Run(); this.viewer1.Document = rpt.Document; }