Advertisement
Guest User

Untitled

a guest
Dec 4th, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.02 KB | None | 0 0
  1. @using ERP.PresentationLayer.Views.Offers
  2. @using Telerik.Reporting
  3. @using Telerik.ReportViewer.Mvc
  4. @{
  5. ViewBag.Title = "Telerik MVC HTML5 Report Viewer";
  6. }
  7.  
  8. @section styles
  9. {
  10. <link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet" />
  11.  
  12. <link href="http://cdn.kendostatic.com/2013.2.918/styles/kendo.common.min.css" rel="stylesheet" />
  13. <link href="http://cdn.kendostatic.com/2013.2.918/styles/kendo.blueopal.min.css" rel="stylesheet" />
  14.  
  15.  
  16. <style>
  17. #reportViewer1 {
  18. position: absolute;
  19. left: 5px;
  20. right: 5px;
  21. top: 5px;
  22. bottom: 5px;
  23. overflow: hidden;
  24. font-family: Verdana, Arial;
  25. }
  26. </style>
  27.  
  28. <link href="@Url.Content("~/ReportViewer/styles/telerikReportViewer-9.1.15.731.css")" rel="stylesheet" />
  29. }
  30.  
  31. @(Html.TelerikReporting().ReportViewer()
  32. // Each report viewer must have an id - it will be used by the initialization script
  33. // to find the element and initialize the report viewer.
  34. .Id("reportViewer1")
  35. // The URL of the service which will serve reports.
  36. // The URL corresponds to the name of the controller class (ReportsController).
  37. // For more information on how to configure the service please check http://www.telerik.com/help/reporting/telerik-reporting-rest-conception.html.
  38. .ServiceUrl(Url.Content("~/api/reports/"))
  39. // The URL for the report viewer template. The template can be edited -
  40. // new functionalities can be added and unneeded ones can be removed.
  41. // For more information please check http://www.telerik.com/help/reporting/html5-report-viewer-templates.html.
  42. .TemplateUrl(Url.Content("~/ReportViewer/templates/telerikReportViewerTemplate-9.1.15.731.html"))
  43. // Strongly typed ReportSource - TypeReportSource or UriReportSource.
  44. .ReportSource("0")
  45. // Specifies whether the viewer is in interactive or print preview mode.
  46. // PrintPreview - Displays the paginated report as if it is printed on paper. Interactivity is not enabled.
  47. // Interactive - Displays the report in its original width and height with no paging. Additionally interactivity is enabled.
  48. .ViewMode(ViewMode.Interactive)
  49. // Sets the scale mode of the viewer.
  50. // Three modes exist currently:
  51. // FitPage - The whole report will fit on the page (will zoom in or out), regardless of its width and height.
  52. // FitPageWidth - The report will be zoomed in or out so that the width of the screen and the width of the report match.
  53. // Specific - Uses the scale to zoom in and out the report.
  54. .ScaleMode(ScaleMode.Specific)
  55. // Zoom in and out the report using the scale
  56. // 1.0 is equal to 100%, i.e. the original size of the report
  57. .Scale(1.0)
  58. // Sets whether the viewer’s client session to be persisted between the page’s refreshes(ex. postback).
  59. // The session is stored in the browser’s sessionStorage and is available for the duration of the page session.
  60. .PersistSession(false)
  61. // Sets the print mode of the viewer.
  62. .PrintMode(PrintMode.AutoSelect)
  63. // Defers the script initialization statement. Check the scripts section below -
  64. // each deferred script will be rendered at the place of TelerikReporting().DeferredScripts().
  65. .Deferred()
  66. .ClientEvents(
  67. events => events
  68. .RenderingBegin("onRenderingBegin")
  69. .RenderingEnd("onRenderingEnd")
  70. .PrintBegin("onPrintBegin")
  71. .PrintEnd("onPrintEnd")
  72. .ExportBegin("onExportBegin")
  73. .ExportEnd("onExportBegin")
  74. .UpdateUi("onUpdateUi")
  75. .PageReady("onPageReady")
  76. .Error("onError")
  77. )
  78. // Uncomment the code below to see the custom parameter editors in action
  79. //.ParameterEditors(
  80. // editors => editors
  81. // .SingleSelectEditor("createSingleSelectEditor")
  82. // .CustomEditors(new CustomParameterEditor
  83. // {
  84. // MatchFunction = "customMatch",
  85. // CreateEditorFunction = "createCustomEditor"
  86. // })
  87. //)
  88. )
  89.  
  90. @section scripts
  91. {
  92. <script src="@Url.Content("~/ReportViewer/js/telerikReportViewer-9.1.15.731.min.js")"></script>
  93.  
  94. <!--kendo.all.min.js can be used as well instead of kendo.web.min.js and kendo.mobile.min.js-->
  95. <script src="http://cdn.kendostatic.com/2013.2.918/js/kendo.web.min.js"></script>
  96. <!--kendo.mobile.min.js - optional, if gestures/touch support is required-->
  97. <script src="http://cdn.kendostatic.com/2013.2.918/js/kendo.mobile.min.js"></script>
  98.  
  99.  
  100. <script>
  101. function onRenderingBegin() {
  102. console.log("rendering begin!");
  103. }
  104. function onRenderingEnd() {
  105. console.log("rendering end!");
  106. }
  107. function onPrintBegin() {
  108. console.log("print begin!");
  109. }
  110. function onPrintEnd() {
  111. console.log("print end!");
  112. }
  113. function onExportBegin() {
  114. console.log("export begin!");
  115. }
  116. function onExportEnd() {
  117. console.log("export end!");
  118. }
  119. function onUpdateUi() {
  120. console.log("update ui!");
  121. }
  122. function onError() {
  123. console.log("error!");
  124. }
  125. function onPageReady() {
  126. console.log("page ready!");
  127. }
  128.  
  129. function createSingleSelectEditor(placeholder, options) {
  130. var dropDownElement = $(placeholder).html('<div></div>');
  131. var parameter,
  132. valueChangedCallback = options.parameterChanged,
  133. dropDownList;
  134.  
  135. function onChange() {
  136. var val = dropDownList.value();
  137. valueChangedCallback(parameter, val);
  138. }
  139.  
  140. return {
  141. beginEdit: function (param) {
  142.  
  143. parameter = param;
  144.  
  145. $(dropDownElement).kendoDropDownList({
  146. dataTextField: "name",
  147. dataValueField: "value",
  148. value: parameter.value,
  149. dataSource: parameter.availableValues,
  150. change: onChange
  151. });
  152.  
  153. dropDownList = $(dropDownElement).data("kendoDropDownList");
  154. }
  155. };
  156. }
  157.  
  158. function customMatch(parameter) {
  159. return Boolean(parameter.availableValues)
  160. && !parameter.multivalue
  161. && parameter.type === telerikReportViewer.ParameterTypes.BOOLEAN;
  162. }
  163.  
  164. function createCustomEditor(placeholder, options) {
  165. var dropDownElement = $(placeholder).html('<div></div>');
  166. var parameter,
  167. valueChangedCallback = options.parameterChanged,
  168. dropDownList;
  169.  
  170. function onChange() {
  171. var val = dropDownList.value();
  172. valueChangedCallback(parameter, val);
  173. }
  174.  
  175. return {
  176. beginEdit: function (param) {
  177.  
  178. parameter = param;
  179.  
  180. $(dropDownElement).kendoDropDownList({
  181. dataTextField: "name",
  182. dataValueField: "value",
  183. value: parameter.value,
  184. dataSource: parameter.availableValues,
  185. change: onChange
  186. });
  187.  
  188. dropDownList = $(dropDownElement).data("kendoDropDownList");
  189. }
  190. };
  191. }
  192. </script>
  193.  
  194. @(
  195.  
  196. // All deferred initialization statements will be rendered here
  197. Html.TelerikReporting().DeferredScripts()
  198. )
  199. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement