Generate Report With Form Data

Stimulsoft Reports.WEB discussion
Post Reply
mkeuschn
Posts: 17
Joined: Thu Apr 03, 2014 8:56 am

Generate Report With Form Data

Post by mkeuschn »

Hello,

I have a form and want to pass the form parameter to the report controller method to filter the data which will passed to the StiReport. How can I do that?

Code: Select all

@using NursingHomeStock.Resources

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.Title = GlobalResources.Reports;
}

<div class="well">    
    <form class="form-horizontal" role="form">
        <div class="form-group">
            <label for="from" class="col-lg-2 col-md-2 col-sm-2 col-xs-2 control-label">@GlobalResources.From</label>
            <div class="col-lg-10 col-md-10 col-sm-10 col-xs-10">
                @(Html.Kendo().DateTimePicker()
                      .Name("from")
                      .Value(DateTime.Now)
                      )
            </div>
        </div>
        
        <div class="form-group">
            <label for="to" class="col-lg-2 col-md-2 col-sm-2 col-xs-2 control-label">@GlobalResources.To</label>
            <div class="col-lg-10 col-md-10 col-sm-10 col-xs-10">
                @(Html.Kendo().DateTimePicker()
                      .Name("to")
                      .Value(DateTime.Now)
                      )
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="button" class="btn btn-default" onclick="PASS-FORM-PARAMETER-TO-CONTROLLER-ACTION-AND-RENDER-REPORT">Bericht erstellen</button>
            </div>
        </div>
    </form>
</div>

@Html.Stimulsoft().StiMvcViewer("NursingHomeReportViewer", new StiMvcViewerOptions
{
    // Theme = StiTheme.Windows7,
    ActionGetReportSnapshot = "NursingHomeReport",
    Localization = "~/Content/Localization/de.xml",
    ActionViewerEvent = "ViewerEvent",
    ActionExportReport = "ExportReport",
    ActionInteraction = "Interaction",
    ActionPrintReport = "PrintReport",
    Width = Unit.Percentage(100),
    MenuZoom = 150
})
regards,
Marko
Attachments
NursingHomeReport.mrt
(11.25 KiB) Downloaded 215 times
ReportWithForm.PNG
ReportWithForm.PNG (30.51 KiB) Viewed 2018 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Generate Report With Form Data

Post by HighAley »

Hello.

You should create variable in the report that is used in the Filter of the Band and set its value in the controller.

Thank you.
mkeuschn
Posts: 17
Joined: Thu Apr 03, 2014 8:56 am

Re: Generate Report With Form Data

Post by mkeuschn »

How Can I refresh the Report without reloading the whole site? At the Moment I submit the form data (the whole site is reloaded), store it in the session variables and use it in the report method, but I need the selected form data to remain in the form. the best behaviour is that I pass the parameter to the report method without reloading the site.

regards

Code: Select all

 public ActionResult Entire()
        {
            return View();
        }

        [HttpPost]
        public ActionResult EntireData()
        {
            Session["place-types"] = Request.Form["place-types"];
            Session["for-date"] = DateTime.Parse(Request.Form["for-date"]);
            Session["region"] = Request.Form["region"];
            Session["nursinghome"] = Request.Form["nursinghome"];

            return View("Entire");
        }

        public ActionResult EntireNursingHomes()
        {
                // generate report data based on session variables
        }
ReportForm.png
ReportForm.png (15.42 KiB) Viewed 1972 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Generate Report With Form Data

Post by HighAley »

Hello.

Unfortunately, it's impossible to update report in the Viewer without reloading of the whole page.

Thank you.
Post Reply