b6c09f053ec6cf4858e1657053170e9ea460d067
Guides/Webform-Integration-Sub-Folder.md
| ... | ... | @@ -26,7 +26,7 @@ You can also create a new web site in ASP.NET web forms |
| 26 | 26 | |
| 27 | 27 | ###Step 3. Copy contents of Global.asax in webform kit to Global.asax of website |
| 28 | 28 | |
| 29 | -Copy the code from Global.asax of webform kit to Global.asax of website |
|
| 29 | +Copy the below code from Global.asax of webform kit to Global.asax of website |
|
| 30 | 30 | |
| 31 | 31 | ```csharp |
| 32 | 32 | [Serializable] |
| ... | ... | @@ -75,6 +75,74 @@ Copy the code from Global.asax of webform kit to Global.asax of website |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | ``` |
| 78 | + |
|
| 79 | +Also, add Izenda.Adhoc namespace. now global.asax of website should look like as below |
|
| 80 | + |
|
| 81 | +```csharp |
|
| 82 | +<%@ Application Language="C#" %> |
|
| 83 | +<%@ Import Namespace="_Sub_Final" %> |
|
| 84 | +<%@ Import Namespace="System.Web.Optimization" %> |
|
| 85 | +<%@ Import Namespace="System.Web.Routing" %> |
|
| 86 | +<%@ Import Namespace="Izenda.AdHoc" %> |
|
| 87 | + |
|
| 88 | + |
|
| 89 | +<script runat="server"> |
|
| 90 | + |
|
| 91 | + void Application_Start(object sender, EventArgs e) |
|
| 92 | + { |
|
| 93 | + RouteConfig.RegisterRoutes(RouteTable.Routes); |
|
| 94 | + BundleConfig.RegisterBundles(BundleTable.Bundles); |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + |
|
| 98 | + [Serializable] |
|
| 99 | + public class CustomAdHocConfig : FileSystemAdHocConfig { |
|
| 100 | + public static void InitializeReporting() { |
|
| 101 | + //Check to see if we've already initialized. |
|
| 102 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 103 | + return; |
|
| 104 | + //Initialize System |
|
| 105 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 106 | + AdHocSettings.SqlServerConnectionString = @"INSERT_CONNECTION_STRING_HERE"; |
|
| 107 | + AdHocSettings.GenerateThumbnails = true; |
|
| 108 | + AdHocSettings.ChartingEngine = ChartingEngine.HtmlChart; |
|
| 109 | + AdHocSettings.ShowSimpleModeViewer = true; |
|
| 110 | + AdHocSettings.IdentifiersRegex = "^.*[iI][Dd]$"; |
|
| 111 | + AdHocSettings.TabsCssUrl = "Resources/css/tabs.css"; |
|
| 112 | + AdHocSettings.ReportCssUrl = "Resources/css/Report.css"; |
|
| 113 | + AdHocSettings.ShowBetweenDateCalendar = true; |
|
| 114 | + AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 115 | + AdHocSettings.ChartingEngine = ChartingEngine.HtmlChart; |
|
| 116 | + // AdHocSettings.ShowHtmlButton = true; |
|
| 117 | + //AdHocSettings.ShowPDFButton = true; |
|
| 118 | + //Initialize User |
|
| 119 | + //AdHocSettings.VisibleDataSources= |
|
| 120 | + //AdHocSettings.CurrentUserName= |
|
| 121 | + //AdHocSettings.HiddenFilters["Field"] = new string [] {"value1","value2"}; |
|
| 122 | + //Success! |
|
| 123 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 124 | + |
|
| 125 | + AdHocSettings.DashboardDateSliderMode = DashboardDateSliderMode.None; |
|
| 126 | + |
|
| 127 | + AdHocSettings.DashboardViewer = "Dash.aspx"; |
|
| 128 | + AdHocSettings.DashboardDesignerUrl = "Dash.aspx"; |
|
| 129 | + |
|
| 130 | + //EOPDF uses a DLL that converts HTML |
|
| 131 | + //AdHocSettings.PdfPrintMode = PdfMode.EOPDF; |
|
| 132 | + //PhantomJS PDF uses an EXE on the web server that produces the export |
|
| 133 | + AdHocSettings.PdfPrintMode = PdfMode.PhantomJs; |
|
| 134 | + } |
|
| 135 | + public override void ProcessDataSet(System.Data.DataSet ds, string reportPart) { |
|
| 136 | + base.ProcessDataSet(ds, reportPart); |
|
| 137 | + } |
|
| 138 | + public override void PreExecuteReportSet(ReportSet reportSet) { |
|
| 139 | + base.PreExecuteReportSet(reportSet); |
|
| 140 | + } |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | +</script> |
|
| 144 | + |
|
| 145 | +``` |
|
| 78 | 146 | |
| 79 | 147 | |
| 80 | 148 | ###Step 4. Change Namespaces of Controllers |