
I have a report that takes a long time to run. On page load, I default the parameters for the users (most of the time they will use the defaults).
The problem is that, when they load the page (ASP.NET web viewer), and the parameters are filled in, the report runs automatically.
This is a problem because they do not have the opportunity to change the parameters and have to wait a long time for that intial run.
So, I do not want the report to run until they hit the Preview button on the web viewer.
Can someone please advise?
37 Answers, 1 is accepted
This is how the ASP.NET viewer works in the current implementation whenever all report parameters have value and this behavior cannot be changed. If the user is to select a parameter prior running the report, do not set default values for the parameters.
If you prefer to have the most common used as default but want to avoid running the report, what you can do is implement your own UI for the report parameters that is wired to the Report API and this way the report would not be run until you press a "Preview/Run Report" button from your UI.
Best wishes,
Steve
the Telerik team

That is a pretty crappy answer, it seems like a pretty basic feature to just allow it not to auto run. I don't want to have to build my own parameter interface when yours does fairly well.
The current implementation represents our understanding/view of how the report parameters should work and there is no technical limitation that prevents us from making it otherwise. We believe that it is straight-forward (more than anything else) when all parameters have default values, to let the report run automatically. If there is enough interest to halt the viewer and require user interaction, then we would certainly consider it.
Happy Holidays!
All the best,
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!

I have built a dynamic parameter screen for your stuff before, it is just sad that I basically have to redo functionality that is in the control for something as simple as not letting it autorun. It should be as simple as AutoRun="false" and move on. No need to build a custom param screen.
At least you have a way around it, even though it I don't agree with your line of thought on the auto run. I would never let a user just take the defaults and run them. I would give them the opportunity to modify the params.

I would agree with Jonathan, it does seems like a very simple request and from a programming stand point a very logical behavior.
In short, I couldn't agree more with Jonathan's statement below. I think that is a HUGE workaround for such simple functionality that we are needing..
"At least you have a way around it, even though it I don't agree with your line of thought on the auto run. I would never let a user just take the defaults and run them. I would give them the opportunity to modify the params. "

Ditto. We have the exact same situation. Bleah.

My big concern is that you said:
"The current implementation represents our understanding/view of how the report parameters should work and there is no technical limitation that prevents us from making it otherwise."
If there is no technical limitation in adding this functionality, then you should add it. We (your customers) need this functionality because some reports are very process intensive and the user should be able to use the default values we suggest or modify them before the report runs. Conversely, some users may like the auto run, so in that case you can support both sides.
This should be an EASY win for Telerik. Please support this functionality.
Due to the popular demand for this feature we have prepared a workaround for those of you that want to try it. What you have to do is to place the following javascript code at the end of the form element or right after the report viewer's declaration which modified the default behavior of the method which displays the report:
<script type=
"text/javascript"
>
ReportViewer.prototype.GenerateReport = ReportViewer.prototype.RefreshReportArea;
ReportViewer.prototype.RefreshReportArea =
function
(refresh)
{
if
(refresh)
{
this
.GenerateReport(refresh);
}
else
{
this
.DisplayError(
"<br /><br />Click Refresh or Preview button to generate the report."
);
this
.EnableRefreshButton(
true
);
}
}
</script>
Have in mind that the Preview button is only available when there is at least one report parameter that has the AutoRefresh property set to false. You can also customize the sample message so that it best suits your case.
Give it a try and let us know whether we have correctly understood your query. Any feedback will be welcomed.
Greetings,
Chavdar
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewReport.aspx.cs" Inherits="InventoryTRSReportWeb.ViewReport" %>
<%@ Register Assembly="Telerik.ReportViewer.WebForms, Version=6.0.12.215, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
table
width
=
"100%"
>
<
tr
>
<
td
align
=
"center"
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Font-Bold
=
"True"
Font-Size
=
"Large"
></
asp:Label
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
telerik:ReportViewer
ID
=
"ReportViewer1"
runat
=
"server"
Width
=
"100%"
>
</
telerik:ReportViewer
>
<
asp:Label
ID
=
"Label2"
runat
=
"server"
></
asp:Label
>
</
td
>
</
tr
>
</
table
>
</
form
>
</
body
>
</
html
>
This code should be placed after the report viewer declaration. The provided code snippet has been tested locally and verified it works.
All the best,
Steve
the Telerik team
HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!


Is there an equivalent for silverlight ?
Best regards

My workaround was as simple as not only set the reportsource when the user clicks our button.


The HTML5 report viewer widget is usually created within the following script element:
<script type=
"text/javascript"
>
$(
"#reportViewer1"
)
.telerik_ReportViewer({
serviceUrl:
"/api/reports/"
,
templateUrl:
'/ReportViewer/templates/telerikReportViewerTemplate.htmll'
,
reportSource: {
report:
"Telerik.Reporting.Examples.CSharp.ProductCatalog, CSharp.ReportLibrary"
,
parameters: {
CultureID:
"en"
}
}
});
</script>
Instead of just adding the widget, you can create a button on your page that adds the widget. You can do that by attaching an event handler function to the click event of the button.

is this functionality implemented now or is there a workaround to do it with Silverlight ?
Thanks

You can set the initial parameters to such values, which are not going to retrieve lots of data and make the user wait forever to view the report. Or just do not set default values for the parameters and the users will have to set their values.

In order to display a report it is wrapped in a Report Source object. Thus the viewer and the report source are not aware of the underlying report's properties. The engine must try to resolve the report to find out if it requires parameters' values or has any other problem in it.
If you want to control when the report is rendered, you can use custom UI for the parameters area and pass the report and its settings to the viewer when the end-user decides.
Regards,
Stef
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

is there an example/tutorial about pass the report and its settings to the viewer when the end-user decides?
Thanks
Pietro
If the scenario is to change the displayed report, please check the How To: Pass Values to Report Parameters article. By changing the viewer's reportSource from the client, the HTML5 viewer sends a request to the service to get the new report.
Regards,
Stef
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

thanks for your advice,
now I can load reportviewer on user demand by loading a partial view through jquery ajax call.
If you have any other advice please share it.
Thanks.
Regards,
Pietro.
There is nothing to add. More details are available in the forum thread you opened on the same question.
If you have any issue, please feel free to open a support ticket or post the question in the public forum.
Regards,
Stef
Telerik
See What's Next in App Development. Register for TelerikNEXT.

I would just like to add my disappointment at Telerik for the lack of this most basic feature.
This is like reporting 101. 4 years later and they STILL don't have this??
I have a report that takes quite a while to load, and 95% of the time the default parameters are not what the user wants. So they have to sit and wait for it to load, THEN make the changes. Absolutely unacceptable.
Telerik, get your crap together and listen to your users and implement this!
Please test removing the report parameter's default values from the report definition. If the parameters are used in the data-retrieval, the report processing will be stopped due to missing parameters' values.
You can also use custom UI to provide values to report parameters, which will allow you to validate the user selection and run the report only when needed.
I will appreciate it if you elaborate on the scenario, the used viewer and the report's settings. This will help us understand better the case and provide you more accurate suggestions.
Regards,
Stef
Telerik

I totally agree that this is a problem for long reports that take a while to load.
I think telerik should have a report STOP button on the top of the screen with all the other buttons you have. Give the operator ability to cancel searching for the report so they can select other filters and then they can run it again on their own.
Nice red stop sign icon will do.
The feature is supported only by the WinForms Reportviewer, where the thread in which the report is processed can be aborted. Please feel free to log a feature request to have similar functionality for other viewers - feedback portal.
I can suggest you also to test the following settings:
- Filter data on retrieval - Filtering data;
- Once all data is retrieved, check the number of records. On a trial-error basis you can determine what amount of data is suitable for further processing by the report.
- If records are too many, you throw an error, reduce the records or other action.
- If records are in reasonable amount, you can skip the custom logic for preventing their processing.
I hope this information is helpful.
Regards,
Stef
Telerik

Telerik is like Microsoft in this aspect. Even though it is probably a simple change for them to provide an option not to auto-run reports, they refuse to do this out of pure stubbornness or laziness.
I am forced to use the stand-alone report designer in a Silverlight application that I did not build and cannot change to make a custom interface. There should be an option to prevent the auto run.
The Silverlight ReportViewer is a client of the Reporting WCF Service which is hosted on the server machine. When you specify a report it is requested from the server and respectively the reporting engine tries to get the report rendered in XAML for the viewer. This includes processing the report and if there are missing parameters values an error will be returned to the client (viewer).
If you want to avoid the initial evaluation, you can use custom UI and specify the report after the user selected the desired filter values - ApplyParameters Event.
Regards,
Stef
Telerik by Progress

I would just like to add my voice to this thread - this is a basic feature. Telerik is so great in many ways, and then something this basic completely lets it down.
For me - this could be the clincher in that I may have to abandon Telerik Reporting and use something else, which is a shame, because I'm generally impressed with it, but this makes it almost unusable in my use case. Please don't make me go back to Crystal, please, I beg you!
I would recommend people on this thread vote up this feature request here...
https://feedback.telerik.com/Project/162/Feedback/Details/196236-stop-auto-run-of-reports
In the meantime, I'm trying to find a workaround - none of the ones above (empty parameters etc.) work for me, and the custom parameter UI is not ideal in my situation. And I really hate Crystal, so I need to find one...! ;-)
Thank you for this feedback.
Please vote for the logged feature request and include details about the cases where the functionality is required in comments.
The available workarounds are:
- Use custom UI to update the viewer's reportSource - How To: Pass Values to Report Parameters. You will need to make a request to the server to get information about the selected report's ReportParameters collection;
- Use default values for report parameters in the report which will be used initially. you can also use a value that has special meaning for the data retrieval method e.g. add a check for that special value in the WHERE clause of a select statement and return 0 records if it is detected;
- Use custom editors for report parameters in order to avoid having users who submit empty values or values invalid by requirement which will trigger the report processing - How To: Create a Custom Parameter Editor.
Regards,
Stef
Progress Telerik

Hi Stef - is it possible to detect the preview/refresh button click, or to alter its event?
What I'm thinking as an option (not ideal), is to add a boolean parameter, say @RunReport, and include it in the where clause of the report SQL (AND @RunReport = 'true'). This would appear as a on the parameter screen that the user has to tick before any records will be returned.
This obviously isn't but is a workaround for now.
I wondered if it was possible to have this as a hidden parameter, which you could set in the Preview/Refresh button's click event? So that on page load, it's and returns no data, but if you click the button, it sets it to true and data is returned?

@Martin: You can add the SQL parameter in the data-retrieval method and map it to a Boolean report parameter. Leave the report parameter visible, without default value and with AllowNull=false, AllowBlank=false, AutoRefresh=false. This will cause users to first check the parameter and then click the preview button to trigger the document generation.
Catching the Preview button's click event would require you to make changes in the viewer's JS template, and to upgrade the file manually each time:
//telerikReportViewer-x.x.x.x.js
//anout line 2840
$previewButton.on(
"click"
,
function
(e) {
e.preventDefault();
if
(allParametersValid()) {
applyParameters();
}
});
@Raymond: The HTML5 viewer uses HTTP requests to get resources produced on the server machine. Also Reports are processed and rendered on the server machine, where the server polls for the status of the document generation on the server. The document generation starts at the moment the viewer manages to submits values for all report parameters, where it is important how report parameters are configured. If having a null or blank space is a valid value, the processing will be started and it can be terminated only on the server.
Report parameters can be configured to trigger the viewer's parameters validation and to not allow blank values or null as valid values.
The interpretation of parameters values should be done in the data retrieval method or where data is filtered, as it depends on custom requirements. On the other side, proper validation of parameters' values should be done correctly by the viewer based on the report's settings.
We will appreciate it if you elaborate on the settings of your report and the data-retrieval method in order to provide you further suggestions than using custom UI to update parameters and the displayed report.
Regards,
Stef
Progress Telerik

Hi Stef,
Thanks for the suggestion - obviously when I install reporting to a project I only have the .min file for the Report Viewer - where can I get the un-minimised version?
The VS item templates for adding the HTML5 Viewer use the minimized version, but you can replace the link on the page with another modified file. Copies of all HTML5 Viewer's resources are installed by default in C:\Program Files (x86)\Telerik\Reporting <VERSION>\Html5\ReportViewer.
Regards,
Stef
Progress Telerik

OK - I think the quickest and easiest 'solution' to this, shall I say, major bug ;-), is to add a report parameter called 'Confirm Selection', which is a boolean that has to be ticked. I've shown the setup in a screenshot attached. AllowBlank and AllowNull should be false, and the parameter set to Visible.
This prevents the report from auto and allows all of your 'real' parameters to have default values.
It's not ideal, a little clunky, but it does the job.