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

alldayevent checkbox error

8 Answers 100 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Nate
Top achievements
Rank 1
Nate asked on 06 Feb 2008, 01:57 AM
Say I double click when in monthview and I have the scheduler to go to the advanced editor instead of the simple one. This results in a default of "alldayevent" checkbox checked and the start and end times being greyed out. When I try to click the checkbox it throughs a client side javascript error and I am not able to re-enable the time boxes to make it an hour only event.

How can I either repair that functionality or in the codebehind access those other controls to enable them and make it an hour event by default instead of alldayevent?

Thanks

8 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 06 Feb 2008, 04:00 PM
Hello Nate,

Please, try the following solution:

protected void RadScheduler1_FormCreating(object sender, Telerik.Web.UI.SchedulerFormCreatingEventArgs e)     
    {     
        RadScheduler scheduler1 = (RadScheduler)sender;     
    
        if ((scheduler1.SelectedView == SchedulerViewType.MonthView)&(e.Mode == SchedulerFormMode.Insert))     
        {                    
                e.Appointment.Start = e.Appointment.Start.Add(new TimeSpan(8, 0, 0));     
                e.Appointment.End = e.Appointment.Start.Add(new TimeSpan(1, 0, 0));     
        }     
    }    
 


Greetings,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Nate
Top achievements
Rank 1
answered on 06 Feb 2008, 04:21 PM
Thanks Peter. That did work.

Probably a basic question but why do you assign the addition back to the instance? 
e.Appointment.Start = e.Appointment.Start.Add(...
doesn't the Add method do that already? What is the basic programming concept there that I am stupid about?
Like wouldn't just doing e.Appointment.Start.Add(...) add to the existing start property?

Thanks. 
0
Peter
Telerik team
answered on 07 Feb 2008, 02:47 PM
Hi Nate,

This is just to show that you can specify a default start and end time. In this case, all appointments created in month view will start at 8:00 am and end at 9:00 am. You can easily modify this behavior as per your specific requirement.

I hope this makes it clearer.


Greetings,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Philip
Top achievements
Rank 1
answered on 20 Feb 2008, 05:52 PM
I tried converting this to VB:

Protected  Sub RadScheduler1_FormCreating(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerFormCreatingEventArgs)        
        Dim scheduler1 As RadScheduler = CType(sender, RadScheduler)  
   
        If (scheduler1.SelectedView = SchedulerViewType.MonthView)&(e.Mode = SchedulerFormMode.Insert) Then  
                ee.Appointment.Start = e.Appointment.Start.Add(New TimeSpan(8, 0, 0))        
                ee.Appointment.End = e.Appointment.Start.Add(New TimeSpan(1, 0, 0))  
        End If  
End Sub 

and then I assigned OnFormCreating="RadScheduler1_FormCreating" in my Scheduler tag.

But I receive an error when I try to add or modify an appointment:

Sys.WebForms.PageRequestManagerServerErrorException: Conversion from string "TrueTrue" to type 'Boolean' is not valid.

Did I not convert the code properly or is there something else I'm missing? Thanks.
0
T. Tsonev
Telerik team
answered on 22 Feb 2008, 03:17 PM
Hello Philip,

The if statement is incorrect, you should use And instead of & (string concatenation):

Protected Sub RadScheduler1_FormCreating(ByVal sender As ObjectByVal e As Telerik.Web.UI.SchedulerFormCreatingEventArgs) 
    Dim scheduler1 As RadScheduler = DirectCast(sender, RadScheduler) 
 
    If (scheduler1.SelectedView = SchedulerViewType.MonthView) And (e.Mode = SchedulerFormMode.Insert) Then 
        e.Appointment.Start = e.Appointment.Start.Add(New TimeSpan(8, 0, 0)) 
        e.Appointment.[End] = e.Appointment.Start.Add(New TimeSpan(1, 0, 0)) 
    End If 
End Sub 


Sincerely yours,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Philip
Top achievements
Rank 1
answered on 22 Feb 2008, 04:42 PM
That was it...this works great now for new schedule items.

I do have a question regarding items that were originally setup as All Day items though. If I go into edit them (from any mode...month, day, week) and I uncheck the All Day Event box, the time fields are still greyed out. Also, if I uncheck the All Day Event box and save the schedule, next time I go into the Schedule, the All Day Event box is checked again.

Is there something with the same event or maybe with the OnFormCreated event that I can do to change this behavior? Thanks again guys!
0
Peter
Telerik team
answered on 25 Feb 2008, 12:13 PM
Hello Philip,

We have resolved this problem with the latest service pack which was released last week. Could you please try the latest version of Telerik Web.UI and let us know if the problem still persists?


Best wishes,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Philip
Top achievements
Rank 1
answered on 25 Feb 2008, 05:45 PM
I installed the latest build and it works great now. Thanks!
Tags
Scheduler
Asked by
Nate
Top achievements
Rank 1
Answers by
Peter
Telerik team
Nate
Top achievements
Rank 1
Philip
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or