protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e) { nwndDataSet ds = new nwndDataSet(); nwndDataSetTableAdapters.ProductsTableAdapter pta = new nwndDataSetTableAdapters.ProductsTableAdapter(); ASPxGridView gridView = sender as ASPxGridView; pta.FillBy(ds.Products, Convert.ToInt32(e.Parameters)); gridView.DataSource = ds.Products; Session["gridDataSource"] = gridView.DataSource; gridView.DataBind(); gridView.PageIndex = 0; }
protected void Page_Load(object sender, EventArgs e) { nwndDataSet ds = GetData(); ASPxGridView1.DataSource = ds; ASPxGridView1.DataMember = ds.Categories.TableName; ASPxGridView1.DataBind(); XtraReport1 report = GetReport(); string selectedIDs = HiddenField1.Value.Trim(new char[] { ',' }); report.FilterString = string.Format("CategoryID in ({0})", selectedIDs); report.CreateDocument(); ReportViewer1.Report = report; }
protected nwndDataSet GetData() { if ((nwndDataSet)Session["dataset"] == null) { nwndDataSet ds = new nwndDataSet(); CategoriesTableAdapter cta = new CategoriesTableAdapter(); ProductsTableAdapter pta = new ProductsTableAdapter(); cta.Fill(ds.Categories); pta.Fill(ds.Products); Session["dataset"] = ds; } return((nwndDataSet)Session["dataset"]); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { string resourceFileName = "XtraReport1.resx"; this.Detail = new DevExpress.XtraReports.UI.DetailBand(); this.xrPictureBox1 = new DevExpress.XtraReports.UI.XRPictureBox(); this.xrLabel3 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel2 = new DevExpress.XtraReports.UI.XRLabel(); this.PageHeader = new DevExpress.XtraReports.UI.PageHeaderBand(); this.xrLabel1 = new DevExpress.XtraReports.UI.XRLabel(); this.PageFooter = new DevExpress.XtraReports.UI.PageFooterBand(); this.nwndDataSet1 = new nwndDataSet(); this.categoriesTableAdapter1 = new nwndDataSetTableAdapters.CategoriesTableAdapter(); ((System.ComponentModel.ISupportInitialize)(this.nwndDataSet1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); // // Detail // this.Detail.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { this.xrPictureBox1, this.xrLabel3, this.xrLabel2 }); this.Detail.Height = 142; this.Detail.Name = "Detail"; this.Detail.Padding = new DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F); this.Detail.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft; // // xrPictureBox1 // this.xrPictureBox1.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Image", null, "Categories.Picture", "") }); this.xrPictureBox1.Location = new System.Drawing.Point(500, 42); this.xrPictureBox1.Name = "xrPictureBox1"; this.xrPictureBox1.Size = new System.Drawing.Size(133, 67); // // xrLabel3 // this.xrLabel3.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "Categories.Description", "") }); this.xrLabel3.Location = new System.Drawing.Point(25, 83); this.xrLabel3.Name = "xrLabel3"; this.xrLabel3.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); this.xrLabel3.Size = new System.Drawing.Size(308, 25); this.xrLabel3.Text = "xrLabel3"; // // xrLabel2 // this.xrLabel2.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "Categories.CategoryName", ""), new DevExpress.XtraReports.UI.XRBinding("Tag", null, "Categories.CategoryID", "") }); this.xrLabel2.Location = new System.Drawing.Point(25, 42); this.xrLabel2.Name = "xrLabel2"; this.xrLabel2.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); this.xrLabel2.Size = new System.Drawing.Size(133, 25); this.xrLabel2.Text = "xrLabel2"; this.xrLabel2.HtmlItemCreated += new DevExpress.XtraReports.UI.HtmlEventHandler(this.xrLabel2_HtmlItemCreated); // // PageHeader // this.PageHeader.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { this.xrLabel1 }); this.PageHeader.Height = 42; this.PageHeader.Name = "PageHeader"; this.PageHeader.Padding = new DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F); this.PageHeader.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft; // // xrLabel1 // this.xrLabel1.Font = new System.Drawing.Font("Times New Roman", 25F); this.xrLabel1.Location = new System.Drawing.Point(250, 0); this.xrLabel1.Name = "xrLabel1"; this.xrLabel1.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); this.xrLabel1.Size = new System.Drawing.Size(158, 42); this.xrLabel1.StylePriority.UseFont = false; this.xrLabel1.Text = "Categories"; // // PageFooter // this.PageFooter.Height = 30; this.PageFooter.Name = "PageFooter"; this.PageFooter.Padding = new DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F); this.PageFooter.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft; // // nwndDataSet1 // this.nwndDataSet1.DataSetName = "nwndDataSet"; this.nwndDataSet1.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // categoriesTableAdapter1 // this.categoriesTableAdapter1.ClearBeforeFill = true; // // XtraReport1 // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { this.Detail, this.PageHeader, this.PageFooter }); this.DataAdapter = this.categoriesTableAdapter1; this.DataMember = "Categories"; this.DataSource = this.nwndDataSet1; this.Version = "8.2"; ((System.ComponentModel.ISupportInitialize)(this.nwndDataSet1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); }