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

Using DateTimeOffset for DataStartField

8 Answers 171 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 20 Jun 2011, 03:03 PM
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.

8 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 22 Jun 2011, 09:46 AM
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.

0
Matt
Top achievements
Rank 1
answered on 22 Jun 2011, 12:39 PM
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?
0
Plamen
Telerik team
answered on 22 Jun 2011, 03:14 PM
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.

0
Matt
Top achievements
Rank 1
answered on 22 Jun 2011, 03:22 PM
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.

0
Matt
Top achievements
Rank 1
answered on 27 Jun 2011, 03:16 PM
Can anyone from Telerik provide an answer to this question?  Thanks.
0
Plamen
Telerik team
answered on 27 Jun 2011, 04:49 PM
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.

0
Matt
Top achievements
Rank 1
answered on 27 Jun 2011, 04:53 PM
Plamen-

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

Thanks again.
0
Plamen
Telerik team
answered on 28 Jun 2011, 12:06 PM
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.

Tags
Scheduler
Asked by
Matt
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Matt
Top achievements
Rank 1
Share this question
or