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

un-representable DateTime

2 Answers 311 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 26 Apr 2010, 05:12 PM
I have events with no time.  My raw data looks like this:

Start =   2009-04-29 00:00:00.000
End  =   2009-04-29 00:00:00.000

When i try to load the calendar and bind I get the following error:
The added or subtracted value results in an un-representable DateTime. Parameter name: value

               <telerik:RadScheduler runat="server" ID="RadScheduler1" SelectedView="DayView" TimelineView-ShowInsertArea="true" 
                    StartInsertingInAdvancedForm="true" Skin="WebBlue" Width="750px" Height="650px" 
                    TimeZoneOffset="00:00:00" DayStartTime="00:00:00" DayEndTime="00:00:00"  DataSourceID="AppointmentsDataSource" DataKeyField="TaskKeyID" 
                    DataSubjectField="TaskComment" DataStartField="WholeStart" DataEndField="WholeEnd" 
                    HoursPanelTimeFormat="htt" OnFormCreated="RadScheduler1_FormCreated" SelectedDate=""   
 
                    ValidationGroup="RadScheduler1">  
                    <TimelineView UserSelectable="false" /> 
                    <AdvancedForm Modal="true" Width="450" MaximumHeight="450" /> 
                    <ResourceTypes> 
                        <telerik:ResourceType KeyField="TaskType" Name="Type" TextField="TaskType" ForeignKeyField="TaskType" 
                            DataSourceID="sdsTaskTypes" /> 
                        <telerik:ResourceType KeyField="PriorityText" Name="Priority" TextField="PriorityText" 
                            ForeignKeyField="PriorityText" DataSourceID="sdsPriority" /> 
                    </ResourceTypes> 
                </telerik:RadScheduler> 


Error Message: The added or subtracted value results in an un-representable DateTime. Parameter name: value  
Stack Trace: at System.DateTime.Subtract(TimeSpan value) at Telerik.Web.UI.Scheduling.DateHelper.GetStartOfWeek
(DateTime selectedDate, DayOfWeek weekStart) at Telerik.Web.UI.Scheduling.DateHelper.GetWeekLength(DateTime date, 
DayOfWeek firstDayOfWeek, DayOfWeek lastDayOfWeek) at Telerik.Web.UI.Scheduler.Views.Week.ModelBase..ctor(IScheduler owner)
 at Telerik.Web.UI.Scheduler.Views.Week.Model..ctor(IScheduler owner, IWeekTimeSlotFactory slotFactory, TimeSpan 
workDayStartTime, TimeSpan workDayEndTime) at Telerik.Web.UI.Scheduler.Views.Day.Model..ctor(IScheduler owner) at 
Telerik.Web.UI.Scheduler.Views.DayModelFactory.CreateModel() at Telerik.Web.UI.RadScheduler.CreateView() at 
Telerik.Web.UI.RadScheduler.OnDataPropertyChanged() at Telerik.Web.UI.RadScheduler.set_SelectedDate(DateTime value) 
at ASP.employee_calendar_aspx.__BuildControlRadScheduler1() in 
C:\Documents and Settings\ddownie\My Documents\Sasquatch\employee\Calendar.aspx:line 34 
at ASP.employee_calendar_aspx.__BuildControlContent1(Control __ctrl) in
 C:\Documents and Settings\ddownie\My Documents\Sasquatch\employee\Calendar.aspx:line 5 at 
System.Web.UI.CompiledTemplateBuilder.InstantiateIn(Control container) at
 ASP.employee_masterpage_master.__BuildControlContentPlaceHolder1() in 
C:\Documents and Settings\ddownie\My Documents\Sasquatch\Employee\MasterPage.master:line 204 
at ASP.employee_masterpage_master.__BuildControlform1() in C:\Documents and Settings\ddownie\My
 Documents\Sasquatch\Employee\MasterPage.master:line 20 at 
ASP.employee_masterpage_master.__BuildControlTree(employee_masterpage_master __ctrl) in 
C:\Documents and Settings\ddownie\My Documents\Sasquatch\Employee\MasterPage.master:line 1 at
 ASP.employee_masterpage_master.FrameworkInitialize() in 
C:\Documents and Settings\ddownie\My Documents\Sasquatch\Employee\MasterPage.master.vb:line 912308 
at System.Web.UI.UserControl.InitializeAsUserControlInternal() 
at System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, 
HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection)
 at System.Web.UI.Page.get_Master() at System.Web.UI.Page.ApplyMasterPage() at System.Web.UI.Page.PerformPreInit() 
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  
 

2 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 27 Apr 2010, 11:09 AM
Hello David,

The problem is that you've set DayStartTime and DayEndTime to 00:00. Leave them at the default values and set ShowFullTime="true". The appointments should still show fine.

I hope this helps.

All the best,
Tsvetomir Tsonev
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
David
Top achievements
Rank 1
answered on 27 Apr 2010, 02:11 PM
It's always the littlest things you spend the most time on.  Ha.

That did the trick.  And I have also got the "All Day" row showing.

Working Sample here if my oversight can help:
<telerik:RadScheduler runat="server" ID="RadScheduler1" SelectedView="DayView" TimelineView-ShowInsertArea="true" 
                    StartInsertingInAdvancedForm="true"  Width="750px" Height="650px" ShowAllDayRow = "true"   
                    TimeZoneOffset="00:00:00"   DataSourceID="AppointmentsDataSource" DataKeyField="TaskKeyID" 
                    DataSubjectField="TaskComment" DataStartField="StartDate" DataEndField="EndDate" 
                    HoursPanelTimeFormat="htt" OnFormCreated="RadScheduler1_FormCreated"   
                    ValidationGroup="RadScheduler1"

Thank You for great support !
Tags
Scheduler
Asked by
David
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
David
Top achievements
Rank 1
Share this question
or