C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,431 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
dear all
I using visual studio 2022 with MVC NET 8 and C# language and Microsoft reporting service 2016.
I want to print an invoice without displaying the report based on its type, for example: cash payment or home delivery.
Both invoices have different data. A print button has been created in the invoice, and clicking it selects the type of invoice to print. To implement the On Click using JavaScript, use JavaScript.
Is there a better way than using JavaScript to print the report based on the report type?
An attempt to execute this code will display the report.
<button id="Print" onclick="printReport()" style="float : right" type="button">Print </button>
<script> function printReport() {
var reportUrl = "http://MyName/ReportServer/report/POS/InvoiceSale? [email protected]&rs:Command=Render&rs:Format=PDF&rs:Toolbar=none&rc:Parameters=Collapsed"; var printWindow = window.open(reportUrl, "_blank");
printWindow.onload = function () {
printWindow.print();
};
}
</script>