This is a migrated thread and some comments may be shown as answers.

Setting listeners for reports built in stand-aloneTelerik Report Designer

3 Answers 54 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joseph Blank
Top achievements
Rank 1
Joseph Blank asked on 14 May 2013, 06:54 PM
We are developing a reporting system for an enterprise web application.  The report definitions (*.trdx) are all being built using the stand alone Telerik Report Designer so there is no code behind pages associated with the definition files. One of the business requirements is to save sets of parameter values for each report.  I have devised a way to show just the parameters area of a report, but I am not able to access the values set by the user.  All the documentation and other forum threads state that I should be able to hook up listeners to the ReportDocument ItemDataBinding and ItemDataBound events.  I have done that, but the event handlers are not being triggered when a user sets a value and the report viewer refreshed the data.

Here is the setup:
  • A report viewer object is added to an .aspx page (C#).
  • In the code behind, the report definition file is loaded, deserialized and attached to the report viewer via the ReportSource        

   var reportDefinitionFile = Server.MapPath(
"~/app/reports/repository/rpt/" + _reportPath);
  
   var xmlSerializer =
new ReportXmlSerializer();
   reportDocument = (Telerik.Reporting.Report)xmlSerializer.Deserialize(reportDefinitionFile);
   var reportSource =
new InstanceReportSource();
   reportSource.ReportDocument = reportDocument;
   trdParameters.ReportSource = reportSource;

      trdParameters is the report viewer control.  reportDocument is a private variable at the Page level and has been hooked up the listener reportDocument_ItemDataBound:
protected override void OnInit(EventArgs e)
{
    reportDocument.ItemDataBound += new EventHandler(reportDocument_ItemDataBound);
 
    base.OnInit(e);
}
 
private void reportDocument_ItemDataBound(object sender, EventArgs e)
{
    Telerik.Reporting.Processing.Report rpt = (Telerik.Reporting.Processing.Report)sender;
    var obj = rpt.Parameters;
}

When the page is called, the parameters are rendered properly and the report generates properly but event handler is never triggered. Any time a user changes a parameter, the report viewer makes an AJAX call to the Telerik reporting dll and I cannot find a way to intercept that.

I am using Q1 2013 version of Telerik Reporting.

Any ideas?

3 Answers, 1 is accepted

Sort by
0
IvanY
Telerik team
answered on 17 May 2013, 03:55 PM
Hello Brian,

Actually a better alternative would be to create your own parameters area and pass the Report Parameters programmatically to hidden Report Parameters in the report. That is because getting the Report Parameters in the report events is not the correct way of accessing those values and also in the future this functionality might change.

With custom parameters area you will have full control over the parameters and their values.

Regards,
IvanY
the Telerik team

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

0
Joseph Blank
Top achievements
Rank 1
answered on 20 May 2013, 02:26 PM
With all due respect, I am trying to avoid creating a custom parameters UI.  I have seen this as your answer to other posts and was somewhat frustrated by it.  It feels as if I need to re-invent the wheel.  I understand that Telerik sees the request for saving parameter values for re-use as coming from a minority of users.  However, I do not understand why there appears to be such an unwillingness to allow developers to access your built-in functionality for dynamically rendering the UI for report parameters and granting them easy access to the controls created.

I have come up with my own solution for the issue using JQuery and some investigative pattern matching. It remains to be seen if my solution will work in all scenarios, but it keeps me from re-inventing the wheel for the moment.
0
Unknown
Top achievements
Rank 1
answered on 23 May 2013, 01:37 PM
You can create a user function and pass the parameter values to it. Then in the user function you can store those parameters or use them in any other way. This is what we are currently doing since creating a new parameters area is too much of a hassle.
Tags
General Discussions
Asked by
Joseph Blank
Top achievements
Rank 1
Answers by
IvanY
Telerik team
Joseph Blank
Top achievements
Rank 1
Unknown
Top achievements
Rank 1
Share this question
or