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

Problem with TimeSlotContextMenus

7 Answers 109 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Joacim Andersson
Top achievements
Rank 2
Joacim Andersson asked on 22 Mar 2010, 02:58 PM
Hi,

I can't get TimeSlotContextMenus to work, I get a script error saying that "'this._weekModels.0' is null or not an object".

  <Telerik:RadScheduler runat="server" ID="uxScheduler" 
                        DataKeyField="ActivityID" DataEndField="EndDateTime" DataStartField="StartDateTime"   
                        DataSubjectField="Description" HoursPanelTimeFormat="HH:mm" 
                        DayHeaderDateFormat="yyyy-MM-dd" 
                        FirstDayOfWeek="Monday" LastDayOfWeek="Friday" Height="100%" 
                        SelectedView="DayView" ShowDateHeaders="false" ShowResourceHeaders="true" ShowHeader="false" 
                        ShowFooter="true" MinutesPerRow="30" >             
    <MultiDayView UserSelectable="false" NumberOfDays="1" /> 
    <DayView UserSelectable="false" /> 
    <WeekView UserSelectable="false" /> 
    <MonthView UserSelectable="false" /> 
    <TimelineView UserSelectable="false" /> 
    <AppointmentTemplate> 
      <IMSC:ActivityItem ID="uxActivityItem" runat="server" ActivityID='<%#Bind("ID") %>' /> 
    </AppointmentTemplate> 
    <AppointmentContextMenus> 
      <Telerik:RadSchedulerContextMenu runat="server" ID="uxAppointmentMenu">  
        <Items> 
          <Telerik:RadMenuItem runat="server" Text="Open/Edit" value="edit" /> 
          <Telerik:RadMenuItem runat="server" IsSeparator="true" /> 
          <Telerik:RadMenuItem runat="server" Text="Delete" Value="delete" /> 
          <Telerik:RadMenuItem runat="server" IsSeparator="true" /> 
          <Telerik:RadMenuItem runat="server" Text="Cut" Value="cut" /> 
          <Telerik:RadMenuItem runat="server" Text="Copy" Value="copy" /> 
        </Items> 
      </Telerik:RadSchedulerContextMenu> 
    </AppointmentContextMenus> 
    <TimeSlotContextMenus> 
      <Telerik:RadSchedulerContextMenu runat="server" ID="uxTimeSlotMenu">  
        <Items> 
          <Telerik:RadMenuItem runat="server" Text="Create Activity" Value="create" /> 
          <Telerik:RadMenuItem runat="server" IsSeparator="true" /> 
          <Telerik:RadMenuItem runat="server" Text="Paste" Value="paste" /> 
        </Items> 
      </Telerik:RadSchedulerContextMenu> 
    </TimeSlotContextMenus> 
  </Telerik:RadScheduler> 
What I'm doing is keeping the Schedular in DayView and create resources for each date I actually want to show, this is so that it can display dates for non-consecutive days. I don't know if this has something to do with it, but the context menu for a time slot is not coming up. This has totally halted my project and I need to get this fixed.

7 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 23 Mar 2010, 12:34 PM
Hi Joacim,

I tested your code, but there was no problem at my end. Please, check the attached sample.

Best wishes,
Peter
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
Joacim Andersson
Top achievements
Rank 2
answered on 23 Mar 2010, 01:16 PM
Thank you for your reply Peter. I just found the reason for the error, even though I'm totally baffled why it would cause an error, When I define my resources I used the following code:
  Private Sub InitilizeResources()  
    Dim resourceType As New ResourceType("DateString")  
    resourceType.ForeignKeyField = "DateString" 
    uxScheduler.ResourceTypes.Add(resourceType)  
    uxScheduler.GroupBy = "DateString" 
    uxScheduler.SelectedDate = New DateTime(2000, 1, 1)  
  End Sub 
Appearantly setting the ForeignKeyField to a property named "DateString" caused the error, the error occured because the property started with the word "Date". You can imagine that finding this bug was not an easy task.
0
Peter
Telerik team
answered on 23 Mar 2010, 01:29 PM
Hello Joacim,

Setting resourceType.ForeignKeyField = "DateString"  requires that "DateString" is an existing field in your RadScheduler data source. You can see this concept applied in the Defining Resources demo.
 
Let me know if you have further questions or concerns.


Greetings,
Peter
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
Joacim Andersson
Top achievements
Rank 2
answered on 23 Mar 2010, 01:55 PM
DateString was an existing field in the datasource and the databinding by itself worked just fine. The appointments appear in the Scheduler as they are supposed to. I can get a context menu for each appointment. What I couldn't get was a context menu for a TimeSlot and I couldn't resize the appointments (moving them around worked just fine). It looks like the problem is simply because of its name. When I renamed the field (a class property) to something that doesn't start with the word "Date" it worked.
0
Peter
Telerik team
answered on 23 Mar 2010, 02:04 PM

Okay, I see what you mean. Indeed, 'Date' is a reserved key word for grouping by Date as shown in this demo:http://demos.telerik.com/aspnet-ajax/scheduler/examples/resourcegrouping/defaultcs.aspx



Best wishes,
Peter
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
Joacim Andersson
Top achievements
Rank 2
answered on 23 Mar 2010, 02:23 PM
Yes, but I didn't call the property Date did I :) I named it DateString.

I have another question though, is there no server side event that is triggered when you move an appointment? I can only find the OnClientAppointmentMoveStart and OnClientAppointmentMoveEnd events for the client side. 

 

0
Accepted
Peter
Telerik team
answered on 23 Mar 2010, 03:01 PM


The server side AppointmentUpdate event will also fire in this case.


Peter
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.
Tags
Scheduler
Asked by
Joacim Andersson
Top achievements
Rank 2
Answers by
Peter
Telerik team
Joacim Andersson
Top achievements
Rank 2
Share this question
or