API/CodeSamples/ReportDesigner.md
... ...
@@ -0,0 +1,120 @@
1
+#Report Designer Page Code Samples
2
+
3
+[[_TOC_]]
4
+
5
+##About
6
+
7
+Here we will provide helpful code samples that can be used to control the Report Designer page and its various features via the Izenda API. In our demo website, we provide a sample ReportDesigner.aspx page that will be the basis of how to structure your own web page around. The following code samples will be referring to elements found on that sample.
8
+
9
+##Toggling toolbar buttons
10
+
11
+Although Izenda does offer a method of toggling toolbar buttons via our AdHocSettings class, some users may find it more beneficial to refer to the toolbar menu items directly in the context of the Report Designer page. However, we recommend that this be done through the [[AdHocSettings|/API/CodeSamples/AdHocSettings]] class. You will find all of the Report Designer's toolbar buttons there. Here is the code to do so on the Report Designer page.
12
+
13
+```csharp
14
+protected void OnInit(EventArgs e)
15
+{
16
+ string currentReportName = Request.QueryString["rn"];
17
+ if (currentReportName == "payroll" || !AdHocSettings.CurrentUserIsAdmin)
18
+ {
19
+ this.adHocReportDesigner1.Toolbar.Items.Remove("SaveButton");
20
+ this.adHocReportDesigner1.Toolbar.Items.Remove("SaveAsButton");
21
+ }
22
+}
23
+```
24
+
25
+And here is a list of button keys for reference:
26
+
27
+* ReportListButton
28
+* NewButton
29
+* SaveButton
30
+* SaveAsButton
31
+* PDFButton
32
+* HTMLREPORTButton
33
+* SQLButton
34
+* CSVButton
35
+* XLS(MIME)Button
36
+* DOCButton
37
+* XMLButton
38
+* RTFButton
39
+* EMailServerButton
40
+* EMailClientButton
41
+* AdminButton
42
+
43
+Similarly, this could be accomplished by calling the following from global.asax:
44
+
45
+```csharp
46
+ string currentReportName = Request.QueryString["rn"];
47
+ if (currentReportName == "payroll" || !AdHocSettings.CurrentUserIsAdmin)
48
+ AdHocSettings.ShowSaveControls = false;
49
+```
50
+
51
+This would hide both the **Save** and **Save As...** toolbar buttons and is more reliable, as it does not deal with specific string literals.
52
+
53
+##Override Page Level CSS
54
+
55
+Here is a code sample that shows how to override the CSS in the Report Designer page. Essentially, you insert a ``<style> </style>`` tag as shown below after the ``</FORM>`` tag in the page. You can then override the CSS elements. In this example, it also overrides the "Preview" tab CSS for the HTML preview. The classes for the report tables in the "Preview" tab are the same CSS tables available in the [[Appearance|/Integration/Tutorials/Appearance]] section of this site. You can use any web browser's developer tools add-on (usually accessed by pressing F12 on the keyboard or ctrl+click if on a Mac with Safari developer tools enabled) to find what CSS classes you need to override. **Caveat:** this will only override them while in the "ReportDesigner.aspx" page.
56
+
57
+```aspnet
58
+<FORM id="Form1" method="post" runat="server">
59
+<cc1:adhocreportdesigner id=queryBuilder runat="server">
60
+</cc1:adhocreportdesigner>
61
+</FORM>
62
+
63
+<style type='text/css'>
64
+
65
+/* Custom styles for report designer */
66
+/* Place this whole <style></style> section right after the </form> tag */
67
+
68
+body
69
+{
70
+font-size: 20px;
71
+font-family: Tahoma;
72
+color: red;
73
+}
74
+
75
+select
76
+{
77
+font-size: 18px;
78
+font-family: Tahoma;
79
+color: blue;
80
+}
81
+
82
+/* You must use expressions in IE for input elements */
83
+INPUT
84
+{
85
+color: expression(this.type== "button" ? 'red' : 'yellow' );
86
+}
87
+
88
+/* For Mozilla and the rest, IE ignores this tag */
89
+input[type="button"]
90
+{
91
+font-size: 12px;
92
+font-family: Tahoma;
93
+color: yellow;
94
+}
95
+
96
+/* Preview tab css settings for the html report preview, it will NOT show this way in report viewer */
97
+
98
+tr.ReportItem td
99
+{
100
+border-style: solid;
101
+border-width: 1px;
102
+font-size: 18pt;
103
+vertical-align: top;
104
+}
105
+table.ReportTable td
106
+{
107
+border-style: solid;
108
+border-width: 0px;
109
+font-family: tahoma;
110
+}
111
+table.ReportTable td
112
+{
113
+border-color: Black;
114
+}
115
+tr.ReportItem
116
+{
117
+color: Black;
118
+}
119
+</style>
120
+```
... ...
\ No newline at end of file