I am using the Telerik Web Report viewer on a webform and have the "ShowPrintButton" enabled. Is there any way to capture when the print button is pressed on either client-side or in the code behind? I know I can add a print button and trigger the print using the client-side API but rather use the default print button on the toolbar.
Any suggestions will help, thanks. :)
10 Answers, 1 is accepted
If you want to keep the default print button our suggestion is to create a class that derives from Telerik.Reporting.Report and attach to Report.ItemDataBinding. This way you will be able to check the query string for the print action as shown in the following code snippet:
public
class
CustomReports:Report
{
public
string
Name{
get
;
set
;}
public
CustomReports()
:
base
()
{
this
.ItemDataBinding +=
new
System.EventHandler(CustomReports_ItemDataBinding);
}
void
CustomReports_ItemDataBinding(
object
sender, System.EventArgs e)
{
var queryString = System.Web.HttpContext.Current.Request.QueryString;
if
(
string
.Compare(queryString[
"optype"
],
"Print"
,
System.StringComparison.InvariantCultureIgnoreCase) == 0)
{
//TO DO before report is printing
}
}
}
Peter
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
From what I see, the Telerik.ReportViewer.WebForms.ReportViewer does have a DataBinding event and I can capture that on the code behind without having to inherit from Telerik.Reporting.Report. However, this databind seems to only occur when the report loads. Any toolbar print or export event does not trigger the databind again. Any suggestions or am I missing something?
Thanks for the help
The Web report viewer doesn't fire any events on print.
Greetings,Peter
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
I am new bie to telerik reports, we are using telerik reports in one of our projects where I need to show the Progress bar till the report ui is updated. Now the report viewer inbuilt progress bar is closed once the report data is loaded. Please guide me.
We are using telerik reports in our project. Telerik ReportViewer is provided with In built progress bar 'Rendering Report' and 'Loading Page' while showing reports . But here i want to use my own customized ProgressBar by hiding the default one which is provided by reportViewer.
Version of the Product we are using :Reporting Q2 2011
@Kishore: there is no out of the box functionality for what you ask for, but this is logged as feature request for all the viewers. If you're using the web report viewer, we can offer the following solution:
<
telerik:ReportViewer
runat
=
"server"
id
=
"ReportViewer1"
Height
=
"570px"
Width
=
"780px"
></
telerik:ReportViewer
>
<
asp:Label
runat
=
"server"
ID
=
"Label1"
></
asp:Label
>
<
script
type
=
"text/javascript"
>
var viewer1 = <%= ReportViewer1.ClientID %>;
viewer1.OnPrintReportLoadedOriginal = viewer1.OnPrintReportLoaded;
viewer1.OnPrint = function()
{
UpdateStatusLabel("Preparing the report to print....");
this.PrintReport();
};
viewer1.OnPrintReportLoaded = function()
{
viewer1.OnPrintReportLoadedOriginal();
UpdateStatusLabel("");
}
function UpdateStatusLabel(msg)
{
var label = document.getElementById('<%=Label1.ClientID %>');
label.innerHTML = msg;
}
</
script
>
Further you can customize the script to show or hide an animated image or implement any other way of displaying the print progress. Hope it helps.
@Vijetha: If you are using the web report viewer, review Applying custom skin to the web report viewer code library. If you are using the WPF or Silverlight viewers, you can edit their templates as described in Creating Style in Expression Blend.
Kind regards,
Steve
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I can't capture the print event!
but the code is the same , why the trial version works but the paid one is not????
I am very disappointment!
When I use the CustomReport, trial version works well, but the paid one is not!
I hope you can help me figure it out!
Thank you!
We've just tried the provided code with the latest internal build 5.3.11.1222 and it works as expected. Copy-paste the provided solution in clean aspx page to make sure nothing interferes with the code execution. Additionally the trial versions of all Telerik products are fully functional and will work for an unlimited time but with a copyright message displayed on each report page, so the same code would work independently of whether you're using dev or trial version.
Kind regards,
Steve
the Telerik team
Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!