-
Notifications
You must be signed in to change notification settings - Fork 1
/
Designer.aspx.cs
42 lines (37 loc) · 1.45 KB
/
Designer.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using DevExpress.DataAccess.Sql;
namespace SimpleWebReportCatalog {
public partial class Designer : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
DesignerTask task = (DesignerTask)Session["DesignerTask"];
if(task != null) {
InitDesignerPage(task);
}
else if(!Page.IsCallback) {
Response.Redirect("Default.aspx");
}
}
private void InitDesignerPage(DesignerTask task) {
BindToData();
switch(task.mode) {
case ReportEdditingMode.NewReport:
// Create a new report from the template.
ASPxReportDesigner1.OpenReport(new ReportTemplate());
break;
case ReportEdditingMode.ModifyReport:
// Load a report from the report storage.
ASPxReportDesigner1.OpenReport(task.reportID);
break;
}
}
private void BindToData() {
SqlDataSource ds = new SqlDataSource("Northwind");
CustomSqlQuery query = new CustomSqlQuery();
query.Name = "Products";
query.Sql = "SELECT * FROM Products";
ds.Queries.Add(query);
ds.RebuildResultSchema();
ASPxReportDesigner1.DataSources.Add("Northwind", ds);
}
}
}