This is a migrated thread and some comments may be shown as answers.

HTML5 viewer passing parameters

7 Answers 447 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 30 Oct 2013, 03:23 PM
I'm having difficulty passing parameters to my reports using the MVC helper. The viewer loads the report correctly, but I'm not sure why it wont accept my passed values. I have an int and string to pass, I'm currently trying:

@{
    var report = new UriReportSource() { Uri = "Report.trdx" };
    report.Parameters.Add(new Telerik.Reporting.Parameter("UserId", Model.UserId));
    report.Parameters.Add(new Telerik.Reporting.Parameter("UserName", Model.UserName));
}

@(Html.TelerikReporting().ReportViewer()
           .Id("reportViewer1")
           .ServiceUrl("/api/reports/")
           .TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate.html")
               .ReportSource(report)
           .ViewMode(ViewModes.INTERACTIVE)
           .ScaleMode(ScaleModes.SPECIFIC)
           .Scale(1.0)
           .PersistSession(true)
        )

This is my first attempt as using the standalone designer, but I setup my parameters in the same fashion as previous reports. I keep getting "not all parameters have valid values". Attached an image with my current parameter setup.

7 Answers, 1 is accepted

Sort by
0
Squall
Top achievements
Rank 1
answered on 01 Nov 2013, 03:46 PM
Hi, Make sure that the Model properties are available. Try to with static values instead of the model.
SN
0
Stephen
Top achievements
Rank 1
answered on 01 Nov 2013, 07:21 PM
Thanks for the reply. I'm really needing this to work. I tried it with static values as you mentioned, but I still get the same result. The UriReportSource does seem to load correctly, when I'm in debug mode I can see the object with the json forming correctly in the parameters. I'm thinking the problem is with the trdx report, or perhaps the serviceurl, which I honestly don't understand completely yet. I have the report setup the same way I did in the internal project, so I'm not sure what I'm missing. I wanted to try and use the internal report to compare, but I can't find any examples of using the helper with an internally built report.
0
Accepted
Stef
Telerik team
answered on 06 Nov 2013, 02:11 PM
Hello Stephen,

If all parameters were set, most probably the problem lies in the Newtonsoft.Json.dll. Your problematic project most probably references the GAC version of Newtonsoft. In order to fix check if Newtonsoft is still installed in the GAC and remove it if so. For a quick fix just delete the Newtonsoft reference from your project and add it using nuget.

Let us know if you need any further help.

Regards,
Stef
Telerik

New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.

0
Stephen
Top achievements
Rank 1
answered on 06 Nov 2013, 03:29 PM
That did work, thanks for the help.
0
Yan
Top achievements
Rank 2
answered on 23 May 2014, 08:30 AM
Hi, I have a same trouble, but update json lib isn't working for me.
after receipt request, my parameters equals null.
but I see data in my parameters in http request.
I send string parameters to avoid problems.
please help me :) I am use Mvc report viewer, and asp.net mvc project on serer side.
0
Yan
Top achievements
Rank 2
answered on 23 May 2014, 08:30 AM
I have a same trouble, but update json lib isn't working for me.
after receipt request, my parameters equals null.
but I see data in my parameters in http request.
I send string parameters to avoid problems.
please help me :)I am use Mvc report viewer, and asp.net mvc project on serer side.
0
Stef
Telerik team
answered on 27 May 2014, 05:50 PM
Hi Yan,

Please test to set the persistSession option to false, to cease the preserving of the report between requests. Then verify that Newtonsoft.Json.dll is not installed in the machine's GAC, and update its reference to the latest available through Nuget.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Stephen
Top achievements
Rank 1
Answers by
Squall
Top achievements
Rank 1
Stephen
Top achievements
Rank 1
Stef
Telerik team
Yan
Top achievements
Rank 2
Share this question
or