Page 1 of 1

Stimulsoft.Reports.Web.NetCore StiDesigner with Angular and Send FormValues

Posted: Fri Apr 10, 2020 5:25 pm
by rabbal
Hello,

I'm using StiDesigner and StiViewer of Stimulsoft.Reports.Web.NetCore package with Angular like your "Web API with Angular" sample for StiViewer in github and as result of my debugging on StiVeiwer it is possible to send formValues to backend like below:

Code: Select all

this.options = new Stimulsoft.Viewer.StiViewerOptions();
this.options.formValues = {__ReportId: 'ReportId'};
//or this.options.routes= {__ReportId: 'ReportId'};
this.viewer = new Stimulsoft.Viewer.StiViewer(this.options, 'MainViewer', false);
this.viewer.renderHtml('viewer');
I have same expectation from StiDesigner to send formValues to responsible backend, but doesn't work and requestParams.FormValues is null on backend.

designer code:

Code: Select all

this.options = new Stimulsoft.Designer.StiDesignerOptions();
this.options.formValues = {__ReportId: 'ReportId'};
this.designer = new Stimulsoft.Designer.StiDesigner(this.options, 'MainDesigner', false);
this.designer.renderHtml('designer');
Thank you.

Re: Stimulsoft.Reports.Web.NetCore StiDesigner with Angular and Send FormValues

Posted: Tue Apr 14, 2020 8:38 am
by Lech Kulikowski
Hello,

Please try to set the options.Server.PassFormValues=true option for the designer on the server side.

Thank you.

Re: Stimulsoft.Reports.Web.NetCore StiDesigner with Angular and Send FormValues

Posted: Wed Apr 15, 2020 5:01 am
by rabbal
Hello,

I have already set it up

Code: Select all

var options = new StiNetCoreDesignerOptions
{
    Theme = StiDesignerTheme.Office2013WhiteBlue,
    Server =
    {
        UseCompression = true,
        PassFormValues = true,
        UseCacheForResources = true
    }
};

return StiNetCoreDesigner.GetScriptsResult(this, options);

Re: Stimulsoft.Reports.Web.NetCore StiDesigner with Angular and Send FormValues

Posted: Fri Apr 17, 2020 9:07 pm
by Lech Kulikowski
Hello,

Thank you for the information.

Re: Stimulsoft.Reports.Web.NetCore StiDesigner with Angular and Send FormValues

Posted: Mon Dec 14, 2020 11:10 am
by EBooksWorld.ir
We encounter the same bug. when we set PassFormValues = true, the following exception rises.

Code: Select all

InvalidCastException: Unable to cast object of type 'Microsoft.Extensions.Primitives.StringValues' to type 'System.IConvertible'.
System.Convert.ToDouble(object value)
I reversed the designer source code and found the problem in StiNetCoreDesigner class on RenderJsonParameters method.

Code: Select all

 if (this.options.Server.PassFormValues && this.htmlHelper.ViewContext.HttpContext.Request.Method == "POST")
      {
        foreach (string key in (IEnumerable<string>) this.htmlHelper.ViewContext.HttpContext.Request.Form.get_Keys())
          hashtable2[(object) key] = (object) this.htmlHelper.ViewContext.HttpContext.Request.Form[key];
      }
The problem is that ToString() is missing on Form[key], so JSON Serialization failed.

Re: Stimulsoft.Reports.Web.NetCore StiDesigner with Angular and Send FormValues

Posted: Tue Dec 15, 2020 8:53 am
by Lech Kulikowski
Hello,

Thank you for the information.