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

Time format conversion error

1 Answer 48 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Zach
Top achievements
Rank 1
Zach asked on 18 Aug 2008, 03:41 PM
The appt times in our database are recorded as ints (0-2400).

This seems to cause a converison issue. We must leave the time formats as is in the database, so how can I work around this on the telerik side of the issue
?

Thanks,
Zach McCain

InvalidCastException: Invalid cast from 'Int16' to 'DateTime'.]
   System.Int16.System.IConvertible.ToDateTime(IFormatProvider provider) +159
   System.Convert.ToDateTime(Object value) +29
   Telerik.Web.UI.Scheduling.DataSourceViewSchedulerProvider.GetAppointments(RadScheduler owner) +489
   Telerik.Web.UI.RadScheduler.PerformSelect() +186
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
   Telerik.Web.UI.RadScheduler.EnsureDataBound() +24
   Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource) +107
   Telerik.Web.UI.RadScheduler.CreateChildControls() +29
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +50
   System.Web.UI.Control.PreRenderRecursiveInternal() +170
   System.Web.UI.Control.PreRenderRecursiveInternal() +170
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 21 Aug 2008, 01:24 PM
Hello Zach,

RadScheduler is designed to work with dates (datetime columns in SQL). If you want to use custom time format, you can either perform a conversion in the queries or implement a custom provider and do the conversions server-side. You can read more about custom providers here:

http://www.telerik.com/help/aspnet-ajax/schedule_databindingimplementingaprovider.html

Both approaches are feasible, it is up to you to decide what will work best.

Best wishes,
Tsvetomir Tsonev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Scheduler
Asked by
Zach
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or