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

Looking to save parameters to DB and repopulate each time report is opened

3 Answers 49 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 22 Nov 2012, 05:12 AM
Hello, I have an MVC 3 web project and have created a reports library.  I am new to Telerik reporting but have done previous reporting using SSRS.  For each of my individual report "MyReport.cs" file(s), I have setup some parameters using the wizard.  When a user selects 5 to 6 different parameters from various drop down lists, textboxes, etc, on a report, I want to give the user the ability to save these parameters to the database.  I need to add a label stating "Save this parameterized report as:" with a textbox after it for the user to enter some text, and a button to submit these to the database.  I then want to open this report at another time with the parameters already filled in.  Are there any examples that show how to do this, how to access the code behind, etc?  Thanks very much...

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 23 Nov 2012, 03:13 PM
Hello Dave,

The built-in report parameters in Telerik Reporting do not offer the functionality you describe. You would have to create your own UI for the report parameters that accomplish what you need and wire this UI to the Reporting API.

Regards,
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!

0
Dave
Top achievements
Rank 1
answered on 24 Nov 2012, 01:17 AM
Steve,

Thanks for the reply and the link to the reporting API.  While I search my way through various areas within the API documentation, could you help clarify something for me?  I have not seen a way to put a submit button on the "MyReport.cs" report file.  Lists, tables, texboxes, checkboxes, etc... but no submit button of any type.  I am assuming there is a way to do this based upon there being a "Preview" button on each of the reports.  Otherwise, will each of the parameterized reports need their own separate MVC report viewer page to accommodate this?  Any code examples or specific API calls to work with that you could direct me to would be appreciated!  Thanks very much for your time.

Dave

0
Steve
Telerik team
answered on 28 Nov 2012, 04:06 PM
Hi Dave,

You do not need a Submit button in a report, as you should not try to use a report to implement custom logic. This logic should be outside of the report viewer/engine and that is why we suggested creating custom UI for saving the parameter values. The Preview button is not even needed and might be skipped altogether if you set the AutoRefresh property of the report parameters to True. This however would only have effect for the visual part of the viewer and would make the built-in report parameter editors post their values without further interaction. In other words, this does not in any way relate to how your own report parameters UI would behave. The report parameter area UI has to be based on the report loaded in the viewer, so the viewer can be one, but your parameter area has to be created dynamically based on the number of parameters your report has. Here is an example

InvoiceReport report1 = new InvoiceReport();
Telerik.Reporting.InstanceReportSource instanceReportSource1 = new  Telerik.Reporting.InstanceReportSource();
instanceReportSource1.ReportDocument = report1;
instanceReportSource1.Parameters.Add(new Telerik.Reporting.Parameter("SaledOrderID", (string)ViewBag.Text));

where a string is passed as parameter value from the controller to the view using the ViewBag.

Greetings,
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!

Tags
General Discussions
Asked by
Dave
Top achievements
Rank 1
Answers by
Steve
Telerik team
Dave
Top achievements
Rank 1
Share this question
or