Query |
Response | |
1) In MVC, On button click, I want to capture new created report file(.rdl)(From Designer) and send to WebAPI to save on web server instead of download and Save to report file on server. |
We can able to customize saving of report using the SaveReportClick event in our Report Designer. So, you can save the report with your appropriate server using this event. Please find the below code snippet for your reference.
| |
2) In MVC, On button click/in backend, I want to capture viewer report/.rdl and create pdf and add to email as attachment. |
Yes, we can able to create the PDF file when clicking the export button in Report viewer. Please find the below code example for how to create and attach the PDF file in Mail.
|
<body>
<div style="width:100%; height:100%; position:absolute;">
<input type="button" id="Save" value="Save Report" />
@{Html.Bold().ReportDesigner("designer").ServiceUrl("/api/DesignerAPI").Render();}
</div>
@(Html.Bold().ScriptManager())
<script type="text/javascript">
$(document).ready(function () {
$("#Save").click(function () {
var designerObj = $("#designer").data("boldReportDesigner");
designerObj.saveReportDefinition((any) => { saveXMLData(any) }, ej.ReportDesigner.DataFormat.XML);
});
});
function saveXMLData(XmlData) {
$.ajax({
url: 'http://localhost:51897/api/DesignerAPI/GetByteArray',
type: 'POST',
contentType: 'text/xml',
data: XmlData,
success: function (data, textStatus, xhr) {
alert("save button");
},
error: function (xhr, textStatus, errorThrown) {
alert('Error in Operation');
}
});
}
</script>
</body> |