Telerik Scheduler "UniqueId property" - how to access it
i use Telerik Demo Sheduler as my base. I have modified data loading like this:
public class SessionAppointmentCollection : ObservableCollection<SessionAppointment>, IAppointmentFactory
{
/// <summary>
/// Gets sample appointments.
/// </summary>
/// <value>The appointments.</value>
public SessionAppointmentCollection(RadScheduler scheduler)
{
// int month = DateTime.Now.Month;
// DateTime mondayDate = CalendarHelper.GetFirstDayOfWeek(DateTime.Today, DayOfWeek.Monday);
// DateTime satDate = CalendarHelper.GetFirstDayOfWeek(DateTime.Today, DayOfWeek.Saturday);
// DateTime lastsundayDate = CalendarHelper.GetEndOfMonth(DateTime.Today);
DataTable dtActions = SqlHelper.GetTable("base_Action_Search");//, new string[] { "@CompanyName", client, "@TaskTypeID", db_TaskTypeID.SelectedValue.ToString() });//, "@Users", Users });
foreach (DataRow dr in dtActions.Rows)
{
SessionAppointment appointmentas = new SessionAppointment();
appointmentas.UniqueId = dr["ActionID"].ToString();
appointmentas.Subject = dr["ActionName"].ToString();
appointmentas.Body = dr["Comments"].ToString();
DateTime start = Convert.ToDateTime(dr["StartDate"].ToString());
appointmentas.Start = start;
appointmentas.End = start.AddMinutes(Convert.ToInt32(dr["Duration"].开发者_Python百科ToString()));
appointmentas.SessionRoom = "01";
appointmentas.Speaker = "Testinis vartotojas";
appointmentas.Level = 300;
appointmentas.Category = dr["Priority"].ToString().Equals("-1") ? scheduler.Categories.GetCategoryByName("WebDevelopement") : scheduler.Categories.GetCategoryByName("WindowsAndFrameworks"); ;
Add(appointmentas);
}
Now i want to implement deleting. But i cant access UniqueID property? How I can do that..?
The post below sheds some light on that: http://www.telerik.com/community/forums/wpf/scheduler/uniqueid-property-how-to-access-it.aspx
Basically, you will have to cast the e.Appointment argument (because it is of type IAppointment) of the AppointmentDeletedEventArgs to RadScheduler's Appointment object in order to have access to UniqueId.
This article gives the following answer, which should work for you:
Appointment appointment = appointmentElement.Appointment as Appointment;
Guid appId = appointment.UniqueId;
精彩评论