locked
stimulreport and mvc core RRS feed

  • Question

  • User-819032351 posted

     hi

    I have a project with stimulreport but Does not display content on the view, my code:

    in controller :

           public IActionResult ViewerEvent()
            {
                return StiNetCoreViewer.ViewerEventResult(this);
            }
    
            public IActionResult Print()
            {
                return View();
            }
            public IActionResult GetReport()
            {
                var report = StiReport.CreateNewReport();
                var path = StiNetCoreHelper.MapPath(this, "/Reports/PrintFactor.mrt");
                report.Load(path);
                var pt = _context.DbSet<Category>().ToList();
                report.RegData("dt",pt);
                return StiNetCoreViewer.GetReportResult(this, report);
            }
    

    in Print view :

    @using Stimulsoft.Report.Web;
    @using Stimulsoft.Report.Mvc;
    @{ Layout = ""; }
    
    <h2>Show Report in the Viewer</h2>
    
    <div class="row">
        @Html.StiNetCoreViewer(new StiNetCoreViewerOptions()
        {
    
            Server =
                            {
             UseRelativeUrls = true,
                                Controller = "Order"
                            },
            Actions =
            {
                GetReport = "GetReport",
                ViewerEvent = "ViewerEvent"
            }
        })
    </div>

    Tuesday, July 28, 2020 2:53 PM

All replies

  • User-2121988648 posted

    Please Check the references:

    https://www.stimulsoft.com/en/samples/mvc/full-screen-mode-in-the-viewer

    https://www.stimulsoft.com/en/samples/mvc/localizing-the-viewer

    Also, please check 

     var pt = _context.DbSet<Category>().ToList();

    If you are getting data correctly. 

    Tuesday, July 28, 2020 3:37 PM
  • User-819032351 posted

    tnx , but my report is empty . my view page is empty .

    in console i have this error :

    Uncaught ReferenceError: StiJsViewer is not defined

    Tuesday, July 28, 2020 3:55 PM
  • User-2121988648 posted

    Try these samples, this might help you

    https://github.com/stimulsoft/Samples-NET.Core-MVC-CSharp

    Tuesday, July 28, 2020 4:39 PM
  • User711641945 posted

    Hi MLT111,

    I could reproduce your issue if I write a wrong controller name in the razor view.Please check your controller name is OrderController:

    Server =
    {
        UseRelativeUrls = true,
        Controller = "Order"
    },

    Besides,how is your `PrintFactor.mrt` like?

    Best Regards,

    Rena

    Wednesday, July 29, 2020 7:22 AM
  • User1116182075 posted

    view 

    @Html.StiNetCoreViewer(new StiNetCoreViewerOptions() { Appearance = { FullScreenMode = true }, Toolbar = { DisplayMode = StiToolbarDisplayMode.Separated }, Actions = { GetReport = "GetNdaReport", ViewerEvent = "ViewerEvent" } })

    controller

    [HttpPost]
            public async Task<IActionResult> GetNdaReport(long employeeId)
            {
                var report = new StiReport();
                var path = StiNetCoreHelper.MapPath(this, "Reports/EmployeeContract/Nda.mrt");
                report.Load(path);
                
                var employee = await employeeClient.GetEmployeeProfileInfoAsync(employeeId);
    
    
                report["NationalCode"] = employee.NationalCode;
                report["EmployeeId"] = employee.Id;
                report["FullName"] = employee.FirstName + " " + employee.LastName;
    
    
                return StiNetCoreViewer.GetReportResult(this, report);
            }

    Wednesday, July 29, 2020 9:07 AM