or
01.uwdataSource = new kendo.data.DataSource({02. transport: {03. read: {04. url: crudServiceBaseUrl + "/GetUnderwriterData"05. },06. create: {07. url: crudServiceBaseUrl + "/POSTaddUnderwriterData",08. type: "POST",09. contentType: "application/json"10. }, 11. update: {12. url: crudServiceBaseUrl + "/POSTUnderwriterData",13. type: "POST",14. contentType: "application/json"15. },16. parameterMap: function (options, operation) {17. if (operation !== "read" && options.models) {18. return kendo.stringify(options.models[0]);19. }20. },21. error: function (args)22. {23. if (args.errors) {24. alert('there was an error');25. var grid = $("#underwriterGrid").data("kendoGrid");26. grid.one("dataBinding", function (e) { 27. e.preventDefault();//cancel grid rebind if error occurs 28. 29. for (var error in args.errors) {30. showMessage(grid.editable.element, error, args.errors[error].errors);31. } 32. });33. }34. 35. }36. },37. schema: {38. //Define the field which contains the error39. errors: function (response) {40. return response.error;41. }, 42.43. },//End of Schema
});
uwdataSource.bind("error", dataSource_error);
01.function showMessage(container, Code, errors) {02. var validationMessageTmpl = kendo.template($("#message").html());03. //add the validation message to the form04. container.find("[data-valmsg-for=" + Code + "],[data-val-msg-for=" + Code + "]").replaceWith($(validationMessageTmpl({ field: Code, message: errors[0] })))05. // .replaceWith(validationMessageTmpl({ field: name, message: errors[0] }))06. }07. 08.function dataSource_error(e) {09. alert(e.xhr.responseText); // displays "error"10. }//Index.cshtml<script type="text/kendo-template" id="message"> <div class="k-widget k-tooltip k-tooltip-validation k-invalid-msg field-validation-error" style="margin: 0.5em; display: block; " data-for="#=field#" data-valmsg-for="#=field#" id="#=field#_validationMessage"> <span class="k-icon k-warning"> </span>#=message#<div class="k-callout k-callout-n"></div> </div></script>
I am using the following code to dynamically set the report source for the HTML5 / MVC viewer. Unfortunately although I can change the current report using the dropdownlist - when the report loads the parameter area stays disabled, do I cannot modify the report parameters from their defaults. Seems to be a CSS issue - how can I fix?
Regards
Ian
@model CLOCS.Models.ReportsViewModel@{ ViewBag.Title = "Reporting";}<h2>Reports</h2>@*<div class="form-group">*@ @Html.LabelFor(model => model.SelectedReportName, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.Kendo().DropDownListFor(m => m.SelectedReportName).Name("reportDropDown").BindTo(Model.ReportClassNamesList).OptionLabel("Select Report") @Html.ValidationMessageFor(model => model.SelectedReportName, "", new { @class = "text-danger" }) </div>@*</div>*@@section styles{ <link href="ReportViewer/styles/ReportViewer-8.0.14.225.css" rel="stylesheet" /><link href="/kendo/styles/kendo.common.min.css" rel="stylesheet" /><link href="/kendo/styles/kendo.blueopal.min.css" rel="stylesheet" /><link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"> <style> #reportViewer1 { position: absolute; left: 5px; right: 5px; top: 180px; bottom: 5px; overflow: hidden; } </style>}@section scripts{ <script> $(document).ready(function () { $("#reportDropDown").change(function () { var value = $(this).val(); if (value && value != "") { var viewer = $("#reportViewer1").data("telerik_ReportViewer"); viewer.reportSource({ report: "CLOCS.Reporting." + value + ", CLOCS.Reporting" } ); viewer.refreshReport(); } }); }); </script> <script src="ReportViewer/js/ReportViewer-8.0.14.225.js"></script>}@(Html.TelerikReporting().ReportViewer() .Id("reportViewer1") .ServiceUrl("/api/telerikreports/") .TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate.html") .ReportSource(new TypeReportSource() { TypeName = "CLOCS.Reporting." + Model.SelectedReportName + ", CLOCS.Reporting" }) .ViewMode(ViewModes.INTERACTIVE) .ScaleMode(ScaleModes.SPECIFIC) .Scale(1.0) .PersistSession(false))