pass a parameter to ActionGetReportSnapshot action?

Stimulsoft Reports.WEB discussion
Post Reply
grahampcharles
Posts: 7
Joined: Sat May 19, 2012 5:59 pm

pass a parameter to ActionGetReportSnapshot action?

Post by grahampcharles »

I'm trying to write a generic GetReportSnapshot action, along the lines of:

Code: Select all

         public ActionResult GetReportSnapshot(string ReportPath)
         {
             // Create the report object and load data 
             StiReport report = new StiReport();
             report.Load(Server.MapPath(ReportPath));

             return StiMvcViewerFxHelper.GetReportSnapshotResult(report, this.Request);
But, of course, I can't compel the StiMvcViewerFx control to pass a parameter to the GetReportSnapshot action. Any ideas how I might accomplish that? I don't want to have to write a new action for every single report in my application.

Thanks for your thoughts!

g.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: pass a parameter to ActionGetReportSnapshot action?

Post by Vladimir »

Hello,

Unfortunately, at this moment a viewer does not transfer any parameters when request the report. To save the report ID or other params, please try to use server session or cache, also you can use the URL routes:
Samples.zip
(5.7 MiB) Downloaded 6722 times
Thank you.
grahampcharles
Posts: 7
Joined: Sat May 19, 2012 5:59 pm

Re: pass a parameter to ActionGetReportSnapshot action?

Post by grahampcharles »

Thanks, I'll make that work! It would be great to get access to the QueryString or some ad-hoc parameters, too, but no biggie.

"Let things work they way they are designed to work..."

;),

g.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: pass a parameter to ActionGetReportSnapshot action?

Post by Vladimir »

Hello,

We are always glad to help you!
We are constantly improving our products and add new features.

Thank you.
brianj774
Posts: 177
Joined: Tue Jan 11, 2011 7:15 am
Location: Minnesota

Re: pass a parameter to ActionGetReportSnapshot action?

Post by brianj774 »

I am also building a generic "getReportSnapshot" action, and could use an easier way to manage 'parameters'... thanks!
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: pass a parameter to ActionGetReportSnapshot action?

Post by HighAley »

Hello.

Do you have any problems with it?

Thank you.
alulko
Posts: 5
Joined: Fri Jan 18, 2013 1:56 pm

Re: pass a parameter to ActionGetReportSnapshot action?

Post by alulko »

Hi, I'm running into the same issue with the StiMvcMobileViewer (mobile) version. Trying to load the report viewer via Ajax call from a main view and pass data to it based on the user selection in the main view. Ajax calls a controller method "LoadReportView" passing user selection data and then returns the partial view which contains @Html.Stimulsoft().StiMvcMobileViewer.
Now "GetReportSnapshot" method in the controller gets called automatically but the data passed from the previous step seems to be lost.


It would be nice to be able to pass data to StiMvcMobileViewer object.
For example:

@Html.Stimulsoft().StiMvcMobileViewer(new StiMvcMobileViewerOptions{
ActionGetReportSnapshot = "GetReportSnapshot",
GetReportSnapshotData = data
})
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: pass a parameter to ActionGetReportSnapshot action?

Post by HighAley »

Hello.

As a way you could use a session for parameter passing.

For example, you could store data in the LoadReportView method:

Code: Select all

Session["MyData"] = data;
In the GetReportSnapshot method you could read this data:

Code: Select all

data = Session["MyData"];
Thank you.
alulko
Posts: 5
Joined: Fri Jan 18, 2013 1:56 pm

Re: pass a parameter to ActionGetReportSnapshot action?

Post by alulko »

Yeah, I ended up using TempData which basically relies on session state until data is read from the dictionary.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: pass a parameter to ActionGetReportSnapshot action?

Post by HighAley »

Hello.

It's a good news. Let us know if you will have any additional help.

Thank you.
Post Reply