on 11-16-2015 5:49 PM
Hello,
I do not see the event in Crystal Report Viewer control to capture event when Print or Export button was clicked.
Clicking these two buttons will create HTTP post back to ASPX web page. I can see this result using Fiddler.
__EVENTTARGET and __EVENTARGUMENT have values
This code work i.e. if I want to attach any code for control when Search button is clicked
Please refer to code sample I provided. For some reasons I could not insert the C# code using Insert option.
Thank you.
Serghei
<head runat="server">
<title>FIM Report</title>
<script src="../../../../../../Scripts/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
document.getElementById("crViewer_toptoolbar_print").addEventListener("click", printEvent);
document.getElementById("crViewer_toptoolbar_export").addEventListener("click", exportEvent);
function printEvent() {
//add logic here this is just a test
alert('Print button was clicked');
}
function exportEvent() {
//add logic here this is just a test
alert('Export button was clicked');
}
});
</script>
</head>
I understand that user can click Cancel button and not going to send document to the printer, but at least I can capture the event.
I solved the problem by using this code.
Without JQuery the code is not going to work because CR print button do the POST. Event should be executed when HTML document is completely loaded.
Hopefully it will save your time if for some reasons you need this functionality.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<script src="../../../../../../Scripts/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#crViewer_toptoolbar_print").click(function () {
console.log('Print button was clicked');
});
$("#crViewer_toptoolbar_export").click(function () {
console.log('Export button was clicked');
});
});
</script>
Or jQuery only
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.