Page 1 of 1

Value cannot be null. Parameter name: key

Posted: Thu Jun 18, 2015 5:23 am
by beginner
I'm trying to view a sample view in the ASP.NET MVC 5 app, but I get the following error in the view file:

Code: Select all

An exception of type 'System.ArgumentNullException' occurred in mscorlib.dll but was not handled in user code
Additional information: Value cannot be null.
This is the view code:

Code: Select all

@using System.Web.UI.WebControls
@using Stimulsoft.Base
@using Stimulsoft.Report
@using Stimulsoft.Report.Mvc


@Html.Stimulsoft().RenderMvcViewerScripts()
@Html.Stimulsoft().StiMvcViewer("MvcViewer1", new StiMvcViewerOptions()
{
    ActionGetReportSnapshot = "FromLoadFileReport",
    ActionViewerEvent = "ViewerEvent"
})

And this is the controller code, but it never hits the server:

Code: Select all

public ActionResult FromLoadFileReport()
        {
            StiReport report = new StiReport();
            string Path = Server.MapPath("~" + ("//Content//Report.mrt"));
            report.Load(Path);
            report.Compile();
            return StiMvcViewer.GetReportSnapshotResult(HttpContext, report);
        }
        public ActionResult PrintReport()
        {

            return StiMvcViewer.PrintReportResult(this.HttpContext);

        }
        public ActionResult ViewerEvent()
        {
            return StiMvcViewer.ViewerEventResult(HttpContext);
        }
        public ActionResult Interaction()
        {
            return StiMvcViewer.InteractionResult(HttpContext);
        }
        public ActionResult ExportReport()
        {
            return StiMvcViewer.ExportReportResult(this.HttpContext);
        }

Can you please guide with this error?

Re: Value cannot be null. Parameter name: key

Posted: Thu Jun 18, 2015 5:48 am
by beginner
Well, I've changed it to the following and everything is working fine :)

Code: Select all

    @Html.Stimulsoft().RenderMvcViewerFxScripts()
    @Html.Stimulsoft().StiMvcViewerFx(new StiMvcViewerFxOptions()
{
    ActionGetReportSnapshot = "FromLoadFileReport",
    Width = Unit.Percentage(100),
    Theme = StiMvcViewerFxOptions.Themes.Office2013,
    ActionExportReport = "ExportReport",
    BackgroundColor = System.Drawing.Color.Silver,
    
})

Re: Value cannot be null. Parameter name: key

Posted: Thu Jun 18, 2015 6:27 am
by Andrew
Hello,

Great! Thank you for sharing your solution here.

Thank you and have a nice day!