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

Passing Datetime Parameter MVC5

1 Answer 166 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 19 Jul 2016, 12:06 AM

I am attempting to utilize this example to render a report inside the browser:

http://docs.telerik.com/reporting/html5-report-viewer-howto-custom-parameters

I cannot determine the proper format for passing datetime in the JSON and continue to get "Failed to convert parameter value from a String to a DateTime"

 

In other words here:

reportSource: { report: "Telerik.Reporting.Examples.CSharp.Invoice, CSharp.ReportLibrary", parameters: { OrderNumber: $('#invoiceId option:selected').val() } },

If I want to pass a datetime  where OrderNumber is, how do I accomplish this?

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 21 Jul 2016, 12:47 PM
Hello Ben,

Depending on the used editor, check what is the obtained value - String or DateTime. If it is a string, you will have to create a Date object or convert the retrieved string before passing it as parameter's value.

In the report configure the report parameter's Type to be DateTime. Such DateTime parameter can be mapped to a DateTime argument of a data retrieval method through a data source component, if needed. Having all values of DateTime type saves you from casting strings to DateTime manually in the report.


If you need further help, please post details about the value returned by the custom editor. The settings of the Report parameter, and how the parameter is used in the report.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Ben
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or