How to send parameter to GetReport action?

Stimulsoft Reports.WEB discussion
Post Reply
faraz_nazem
Posts: 9
Joined: Sat Sep 24, 2016 4:29 pm

How to send parameter to GetReport action?

Post by faraz_nazem »

hi,
i'm using net core 3.1 and stimulsoft report 2020
i have report controller in unit area like this:

Code: Select all

[Area("Unit")]
public class ReportController : Controller
{
public IActionResult View1(int id)
        {
            return View();
        }
 public IActionResult GetReport(int id)
 {
             // some logic
 }
public IActionResult ViewerEvent()
{
            return StiNetCoreViewer.ViewerEventResult(this);
}
}
and view1.cshtml like this:

Code: Select all

@using Stimulsoft.Report.Mvc
@using Stimulsoft.Report.Web

@{
    ViewData["Title"] = "View1";
}
    @Html.StiNetCoreViewer("id1", new StiNetCoreViewerOptions()
    {
        Actions =
        {
            GetReport = "GetReport",
            ViewerEvent = "ViewerEvent",

        },
        Server =
        {
            Controller = "Report",
            RouteTemplate = "Unit/Report/{action}/{id?}"
        },
        Appearance =
        {
            FullScreenMode = false, 
            BookmarksPrint = false , 
            RightToLeft = true
        },
        Toolbar = { 
            ShowPrintButton = false, 
            ShowOpenButton = false, 
            ShowFullScreenButton = false , 
            ShowSaveButton = false , 
            ShowAboutButton = false , 
            ViewMode = StiWebViewMode.Continuous,ShowFindButton = false,

        }
    })
I need to send value for GetReport action id parameter when StiNetCoreViewer call them but i don't know how?
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: How to send parameter to GetReport action?

Post by Lech Kulikowski »

Hello,

In that case, you can use the following code:

Code: Select all

RouteTemplate = "Unit/Report/{action}/" + ViewContext.RouteData.Values["id"]
Thank you.
Post Reply