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

ReportViewer - Report Parameter - String contains GUID value - Not Working

0 Answers 42 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kumar
Top achievements
Rank 1
Kumar asked on 03 Apr 2017, 10:01 PM

I tried this demo's Provided by Telerik.

 

  1. Download the telerik report Demos or open an existing working telerik report from Report Viewer.
  2. Create ObjectDataSource with below model properties. In my case below Id property is Guid. Guid is not supporting in Telerik parameter data types, so we are using String datatype for Id.
           public class TestItem
        {
            public string Id { get; set; }
            public string Name { get; set; }
        }
  3. Add a new Report Parameter with AvailableValues, select the ObjectDataSource created in above step. 
    • Display Member - Name
    • Value Member - Id
  4. Check the Report Parameter attachment for quick review.
  5. Create some mock data for ObjectDataSource created in Step2
    public IEnumerable<TestItem> GetTestItems()
            {
                var results = new List<TestItem>
                {
                    new TestItem { Id = Guid.NewGuid().ToString(), Name = "One" },
                    new TestItem { Id = Guid.NewGuid().ToString(), Name = "Two" },
                    new TestItem { Id = Guid.NewGuid().ToString(), Name = "Three" }
                };
                return results;
            }

   6. Run the sample from Report Viewer, click on Preview is throwing error

Report API details:

  • URL: http://localhost:7137/api/reports/clients/165548-be5b/instances
  • Request Body:                                      

          {"report":"Telerik.Reporting.Examples.CSharp.ReportCatalog, CSharp.ReportLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null","parameterValues":{"Name1":"e0fc65ea-760f-4ffb-9c06-5367a13b555f"}}

  • Response Body:
  • {"message":"","exceptionMessage":"Missing or invalid parameter value. Please input valid data for all parameters.","exceptionType":"Telerik.Reporting.Services.Engine.InvalidParameterException","stackTrace":"   at Telerik.Reporting.Services.Engine.ReportEngine.CreateReportInstance(String clientID, String report, Dictionary`2 parameterValues)\r\n   at Telerik.Reporting.Services.WebApi.ReportsControllerBase.CreateInstance(String clientID, ClientReportSource reportSource) in c:\\temp\\reporting\\RBuild-28199\\Reporting_Build\\Source\\Code\\Telerik.Reporting.Services.WebApi\\ReportsControllerBase.cs:line 188\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4()\r\n   at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)"}

Above sample is working fine in Preview model. Only failing from Report Viewer.

Is this possible to run report using Report Viewer with Guid parameters?

 

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Kumar
Top achievements
Rank 1
Share this question
or