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

Help with Changing Dates to ID and ID to Dates for Drag and Drop Scheduling

1 Answer 48 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Tommy
Top achievements
Rank 1
Tommy asked on 30 Nov 2010, 10:04 PM
Hi,

Trying to setup the scheduler for dates on a table setup with IDs and Moving them. Got it to load but cant edit anything. Here is my code

<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
    </div>
    <telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="RotationStart"
        DataKeyField="ScheduleID" DataSourceID="SchedulerDataSource" DataStartField="RotationStart"
        DataSubjectField="FullName" AllowInsert="False" GroupBy="ServiceName" 
        GroupingDirection="Vertical" Height="600px" SelectedDate="2010-06-28" 
        SelectedView="TimelineView" Skin="Black">
        <ResourceTypes>
            <telerik:ResourceType DataSourceID="ServiceDataSource" 
                ForeignKeyField="ServiceID" KeyField="ServiceID" Name="ServiceName" 
                TextField="ServiceName" />
        </ResourceTypes>
        <TimelineView NumberOfSlots="8" SlotDuration="7.00:00:00" />
    </telerik:RadScheduler>
    <asp:SqlDataSource ID="SchedulerDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleEvaluateConnectionString %>"
        DeleteCommand="DELETE FROM Schedule WHERE (ScheduleID = @ScheduleID)" InsertCommand="INSERT INTO Schedule(StudentID, ServiceID, RotationID) VALUES (@StudentID, @ServiceID, @RotationID)"
        SelectCommand="SELECT Schedule.ScheduleID, Schedule.StudentID, Schedule.ServiceID, Schedule.RotationID, Rotation.RotationNumber, Rotation.RotationWeek, Rotation.RotationStart, Rotation.RotationEnd, Service.ServiceName, Service.ServiceMax, Student.FullName FROM Rotation INNER JOIN Schedule ON Rotation.RotationID = Schedule.RotationID INNER JOIN Service ON Schedule.ServiceID = Service.ServiceID INNER JOIN Student ON Schedule.StudentID = Student.StudentID"
        UpdateCommand="UPDATE    Schedule
SET              StudentID = @StudentID, ServiceID = @ServiceID, RotationID =
                          (SELECT     RotationID
                            FROM          Rotation
                            WHERE      (RotationStart = @StartDate))
WHERE     (ScheduleID = @ScheduleID)">
        <DeleteParameters>
            <asp:Parameter Name="ScheduleID" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="StudentID" />
            <asp:Parameter Name="ServiceID" />
            <asp:Parameter Name="RotationID" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="StudentID" />
            <asp:Parameter Name="ServiceID" />
            <asp:Parameter Name="StartDate" />
            <asp:Parameter Name="ScheduleID" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="ServiceDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleEvaluateConnectionString %>"
        SelectCommand="SELECT [ServiceID], [ServiceName] FROM [Service] ORDER BY [ServiceName]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="StudentDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleEvaluateConnectionString %>"
        SelectCommand="SELECT [StudentID], [FullName] FROM [Student] ORDER BY [FullName]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="RotationDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleEvaluateConnectionString %>"
        SelectCommand="SELECT [RotationID], [RotationStart] FROM [Rotation] ORDER BY [RotationStart]">
    </asp:SqlDataSource>
    </form>

My Update command works in the query Builder when i plug in the correct id's an dates but unfortunately i get an error when i try timeline drag and drop changing.

Item has already been added. Key in dictionary: 'RotationStart'  Key being added: 'RotationStart'

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 03 Dec 2010, 11:26 AM
Hi Tommy,

I have noticed that you bind the DataStartField and DataEndField to the same field from your data source:

<telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="RotationStart"
DataKeyField="ScheduleID" DataSourceID="SchedulerDataSource" DataStartField="RotationStart"

Is this on purpose? I suggest you create a separate column to bind the DataEndField property to.


Kind regards,
Peter
the Telerik team
Browse the vast support resources we have to jumpstart 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
Tommy
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or