Using DateTimeOffset for DataStartField

9 posts, 0 answers
  1. Matt
    Matt avatar
    9 posts
    Member since:
    Jun 2011

    Posted 20 Jun 2011 Link to this post

    When trying to use a .NET DateTimeOffset property for the RadScheduler.DataStartField and DataEndField property, I get the following error on DataBind:

    Unable to cast object of type 'System.DateTimeOffset' to type 'System.IConvertible'

    Is it possible to use DateTimeOffset as a data field?

    Thanks.
  2. Plamen
    Admin
    Plamen avatar
    2960 posts

    Posted 22 Jun 2011 Link to this post

    Hello Matt,

    By default the DataStartField and the DataEndField are of type DateTime. We recommend using the TimeZoneOffset property of the RadScheduler as in the demo instead of trying to change the type of the fields to DateTimeOffset.

    All the best,
    Plamen Zdravkov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Matt
    Matt avatar
    9 posts
    Member since:
    Jun 2011

    Posted 22 Jun 2011 Link to this post

    Thanks for the reply Plamen, but our database uses DateTimeOffset to store our Start and End times.  Can you please provide some help for a solution?

    Or are you saying that I can use DateTimeOffset for DataStartField and DataEndField as long as I also set the TimeZoneOffset property?
  4. Plamen
    Admin
    Plamen avatar
    2960 posts

    Posted 22 Jun 2011 Link to this post

    Hello Matt,

    In that case you can use a converter from DateTimeOffset to DateTime. Please take a look at this MSDN article for how to convert between DateTime and DateTimeOffset.

    Hope this helps.

    Greetings,
    Plamen Zdravkov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  5. Matt
    Matt avatar
    9 posts
    Member since:
    Jun 2011

    Posted 22 Jun 2011 Link to this post

    Plamen, I'm not sure your response helps.

    I'm trying to set the DataStartField and DataEndField using this methodology:

    Dim s As New RadScheduler()
    s.ID = "MyScheduler"
    s.DataSource = [MyListOfCustomObjects]
    s.DataKeyField = "RepetitionID"
    s.DataSubjectField = "ShortName"
    s.DataStartField = "BeginDateTime"
    s.DataEndField = "EndDateTime"
    s.SelectedDate = Date.Today
    s.SelectedView = SchedulerViewType.MonthView
    s.DataBind()

    Unfortunately this will not work (and throw the exception I listed in my first post), as "BeginDateTime" and "EndDateTime" are both DateTimeOffset data types from SQL Server.  I need to know if the RadScheduler can somehow support DateTimeOffset values.

  6. Matt
    Matt avatar
    9 posts
    Member since:
    Jun 2011

    Posted 27 Jun 2011 Link to this post

    Can anyone from Telerik provide an answer to this question?  Thanks.
  7. Plamen
    Admin
    Plamen avatar
    2960 posts

    Posted 27 Jun 2011 Link to this post

    Hi Matt,

    We inspected the issue and it seems that RadScheduler accepts only DateTime type for StartTime and EndTime fields and do not support DateTimeOffset for these properties.

    All the best,
    Plamen Zdravkov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  8. Matt
    Matt avatar
    9 posts
    Member since:
    Jun 2011

    Posted 27 Jun 2011 Link to this post

    Plamen-

    Thank you for the reply.  Can you please create a feature request to allow DataStartField and DataEndField to accept DateTimeOffset values?

    Thanks again.
  9. Plamen
    Admin
    Plamen avatar
    2960 posts

    Posted 28 Jun 2011 Link to this post

    Hello Matt,

    Thank you for the suggestion. We will consider it.

    All the best,
    Plamen Zdravkov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top