"Specified cas is not valid" Error when assigning Date variables to RangeSeriesItems

3 posts, 0 answers
  1. Jerry
    Jerry avatar
    6 posts
    Member since:
    Jul 2014

    Posted 06 Apr 2015 Link to this post

    I have a RangeBarChart where the X Axis represents the time of the day from 6am to 10pm.  The Y Axis represents a number of events.  Each event consists of a StartTime variable and an EndTime variable (both are DateTime datatypes).  I am adding the Series programmatically in ASP.NET VB.  

    The data is pulled from an SQL Database.  When I assign the variables, I get a "Specified cast is not valid".  Presumably, the RangeSeriesItem is looking for a different datatype than DateTime.

    While UserReader.Read()
                    Dim AdjudicatorSeriesItem As New RangeSeriesItem(UserReader("fldNotesDateStart"), UserReader("fldNotesDateEnd"))
                    AdjudicatorSeries.SeriesItems.Add(AdjudicatorSeriesItem)
     
    End While

     

    Any ideas?

     

  2. Jerry
    Jerry avatar
    6 posts
    Member since:
    Jul 2014

    Posted 06 Apr 2015 in reply to Jerry Link to this post

    Apparently the XAxis has to be cast in date format somehow.  I found a one line reference to it, but no details.

    Is there anybody out there or is this blog thing wasting my time?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 07 Apr 2015 Link to this post

    Hi Jerry,

    I have already replied to your question in the support ticket that was opened by your so I paste my answer below for the community:

    RadHtmlChart support only date x-axis. That being said you cannot display date time spans on the y-axis. What I can suggest is that you try the following:
        - Convert the .NET datetime values to its JavaScript equivalent in decimal format from the code behind.
        - Format the labels/tooltips to date time on the client side.

    Such an example with scatter chart is illustrated here - http://www.telerik.com/help/aspnet-ajax/htmlchart-application-programmatic-creation-of-seriesitems-with-datetime.html but you can also try to apply this approach for the range bar charts.


    As for the response time - we guarantee . 24-hour maximum lead time for licenses Mon-Fri, excluding public holidays and 72-hour lead time for trial licenses. More information is available here - http://www.telerik.com/purchase/support-plans/devtools Although the response time for forum threads is not guaranteed we try our best to answer them as well when available.

    Regards,
    Danail Vasilev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top