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

Radscheduler

2 Answers 84 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
selvi
Top achievements
Rank 1
selvi asked on 14 Oct 2008, 05:53 PM
hi 
    i need update the scheduler so what is the code for update. 

2 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 15 Oct 2008, 10:46 AM
Hello Selvi,

Please, review the Binding To Generic List example. The code which handles the AppointmentUpdate event is as follows:

 public void CopyInfo(Appointment source)  
        {  
            Subject = source.Subject;  
            Start = source.Start;  
            End = source.End;  
            RecurrenceRule = source.RecurrenceRule;  
            if (source.RecurrenceParentID != null)  
            {  
                RecurrenceParentID = source.RecurrenceParentID.ToString();  
            }  
 
            Resource user = source.Resources.GetResourceByType("User");  
            if (user != null)  
            {  
                UserID = (int?) user.Key;  
            }  
            else 
            {  
                UserID = null;  
            }  
        }  
 
//*   *   *  
 
protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)  
        {  
            AppointmentInfo ai = FindById(e.ModifiedAppointment.ID);  
            ai.CopyInfo(e.ModifiedAppointment);  
        }  
 

If you are binding RadScheduler to a data source, let the data source handle the update. For example:

 
        <telerik:RadScheduler ID="RadScheduler1" runat="server" 
          WeekView-DayStartTime="10:00" WeekView-DayEndTime="17:00" DataEndField="End" 
            DataKeyField="ID" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID" 
            DataSourceID="AccessDataSource1" DataStartField="Start" DataSubjectField="Name">  
        </telerik:RadScheduler> 
 
    <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/scheduler1.mdb" 
        DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = ?" InsertCommand="INSERT INTO [Appointments] ([Name], [Start], [End], [RecurrenceRule], [RecurrenceParentID], [RoomID], [Annotations]) VALUES (?, ?, ?, ?, ?, ?, ?)" 
        SelectCommand="SELECT * FROM [Appointments]" UpdateCommand="UPDATE [Appointments] SET [Name] = ?, [Start] = ?, [End] = ?, [RecurrenceRule] = ?, [RecurrenceParentID] = ?, [RoomID] = ?, [Annotations] = ? WHERE [ID] = ?">  
        <DeleteParameters> 
            <asp:Parameter Name="ID" Type="Int32" /> 
        </DeleteParameters> 
        <UpdateParameters> 
            <asp:Parameter Name="Name" Type="String" /> 
            <asp:Parameter Name="Start" Type="DateTime" /> 
            <asp:Parameter Name="End" Type="DateTime" /> 
            <asp:Parameter Name="RecurrenceRule" Type="String" /> 
            <asp:Parameter Name="RecurrenceParentID" Type="Int32" /> 
            <asp:Parameter Name="RoomID" Type="Int32" /> 
            <asp:Parameter Name="Annotations" Type="String" /> 
            <asp:Parameter Name="ID" Type="Int32" /> 
        </UpdateParameters> 
        <InsertParameters> 
            <asp:Parameter Name="Name" Type="String" /> 
            <asp:Parameter Name="Start" Type="DateTime" /> 
            <asp:Parameter Name="End" Type="DateTime" /> 
            <asp:Parameter Name="RecurrenceRule" Type="String" /> 
            <asp:Parameter Name="RecurrenceParentID" Type="Int32" /> 
            <asp:Parameter Name="RoomID" Type="Int32" /> 
            <asp:Parameter Name="Annotations" Type="String" /> 
        </InsertParameters> 
    </asp:AccessDataSource> 



Best wishes,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
selvi
Top achievements
Rank 1
answered on 18 Oct 2008, 09:25 AM
hi peter,
   Thanx for u r reply, i  am using schedular control in my project.i have connected to sqlserver database.i need insert,update,delete in sql through coding.
thanx in advance.
Tags
Scheduler
Asked by
selvi
Top achievements
Rank 1
Answers by
Peter
Telerik team
selvi
Top achievements
Rank 1
Share this question
or