Passing Datetime Parameter MVC5

2 posts, 0 answers
  1. Ben
    Ben avatar
    5 posts
    Member since:
    May 2016

    Posted 18 Jul 2016 Link to this post

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

    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?

  2. Stef
    Stef avatar
    3610 posts

    Posted 21 Jul 2016 Link to this post

    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.

    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
Back to Top