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

Edit Appoinment Data binding how to write

1 Answer 131 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
yin tong
Top achievements
Rank 1
yin tong asked on 12 Apr 2010, 08:03 AM
using System;  
using System.Collections.Generic;  
using System.ComponentModel;  
using System.Data;  
using System.Drawing;  
using System.Linq;  
using System.Text;  
using System.Windows.Forms;  
using IMMC.XPExplorerBar;  
using IMMC.Forms;  
using IMMC.Business;  
using IMMC.Data;  
using IMMC.Properties;  
using IMMC.Forms.Properties;  
using System.Data.SqlClient;  
using System.Windows.Forms.DataVisualization.Charting;  
using Telerik.WinControls.UI;  
using Telerik.WinControls.UI.Scheduler;  
using Telerik.WinControls.UI.Scheduler.Dialogs;  
 
 
 
namespace IMMC  
{  
    public partial class frmRadControls : Form   
    {  
        public frmRadControls()  
        {  
            InitializeComponent();  
        }  
 
        private List<MyAppointment> appointments = new List<MyAppointment>();  
        protected override void OnLoad(EventArgs e)  
        {  
            base.OnLoad(e);  
 
            DateTime baseDate = DateTime.Today;  
            DateTime[] start = new DateTime[] { baseDate.AddHours(14.0), baseDate.AddDays(1.0).AddHours(9.0), baseDate.AddDays(2.0).AddHours(13.0) };  
            DateTime[] end = new DateTime[] { baseDate.AddHours(16.0), baseDate.AddDays(1.0).AddHours(15.0), baseDate.AddDays(2.0).AddHours(17.0) };  
            string[] summaries = new string[] { "Mr. Brown""Mr. White""Mrs. Green" };  
            string[] descriptions = new string[] { """""" };  
            string[] locations = new string[] { "City""Out of town""Service Center" };  
 
 
 
            MyAppointment appointment = null;  
            for (int i = 0; i < summaries.Length; i++)  
            {  
                appointment = new MyAppointment(start[i], end[i], summaries[i],  
                    descriptions[i], locations[i]);  
                this.appointments.Add(appointment);  
            }  
            //this.radScheduler.AppointmentFactory = new CustomAppointmentFactory();  
            //schedulerBindingDataSource1.EventProvider.AppointmentFactory = radScheduler.AppointmentFactory;  
        }  
        private void radButton_Click(object sender, EventArgs e)  
        {    
            SchedulerBindingDataSource dataSource = new SchedulerBindingDataSource();  
            AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo();  
            appointmentMappingInfo.Start = "Start";  
            appointmentMappingInfo.End = "End";  
            appointmentMappingInfo.Summary = "Subject";  
            appointmentMappingInfo.Description = "Description";  
            appointmentMappingInfo.Location = "Location";  
            appointmentMappingInfo.UniqueId = "Id";  
 
            SchedulerMapping idMapping = appointmentMappingInfo.FindByDataSourceProperty("Id");  
            //idMapping.ConvertToDataSource = new ConvertCallback(this.ConvertIdToDataSource);  
            //idMapping.ConvertToScheduler = new ConvertCallback(this.ConvertIdToScheduler);  
 
            dataSource.EventProvider.Mapping = appointmentMappingInfo;  
            dataSource.EventProvider.DataSource = this.appointments;  
 
            this.radScheduler.DataSource = dataSource;  
 
        }  
    }  
}  
 
1.Edit Appoinment Data binding how to write
2.RadSchedulerThis control how to display the database data

1 Answer, 1 is accepted

Sort by
0
Dobry Zranchev
Telerik team
answered on 14 Apr 2010, 02:24 PM
Hello yin tong,

The code that you use is for objects mapping, not for database mapping. Please take a look at the Data Binding example of RadScheduler (Dataset binding). In addition, please refer to the following link to start with: http://www.telerik.com/help/winforms/declarative_databinding.html.

Do not hesitate to contact us if you have other questions.

Regards,
Dobry Zranchev
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 and Reminder
Asked by
yin tong
Top achievements
Rank 1
Answers by
Dobry Zranchev
Telerik team
Share this question
or