Hi,
I am generating radsceduler controls at run time. I also set the AppointmentDelete event to the appropriate event handler. This event gets fired all right when set at design time, but doesn't fire for radascheduler created at runtime. However another event assigned to the dynamically created scheduler, Appointmentcreated, gets fired all right.
Any help on this one will be highly appreciated.
Kind Regards
I am generating radsceduler controls at run time. I also set the AppointmentDelete event to the appropriate event handler. This event gets fired all right when set at design time, but doesn't fire for radascheduler created at runtime. However another event assigned to the dynamically created scheduler, Appointmentcreated, gets fired all right.
Any help on this one will be highly appreciated.
Kind Regards
3 Answers, 1 is accepted
0
Hi Mark,
Could you please show me the code for the OnAppointmentDelete event created runtime?
Greetings,
Veronica Milcheva
the Telerik team
Could you please show me the code for the OnAppointmentDelete event created runtime?
Greetings,
Veronica Milcheva
the Telerik team
Browse the vast support resources we have to jump start 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.
0
Mark
Top achievements
Rank 1
answered on 16 Feb 2011, 10:06 AM
/********** CODE STARTS*******************/
//////// AppointmentDelete EVENT
protected void RadScheduler1_AppointmentDelete(object sender, Telerik.Web.UI.SchedulerCancelEventArgs e)
{
sds_Update_Events.DeleteParameters["event_ref"].DefaultValue = e.Appointment.ID.ToString();
sds_Update_Events.Delete();
Response.Redirect("PlanEvents.aspx?view=" + rad_View.SelectedValue);
}
//////// AppointmentCreated EVENT
protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)
{
WebControl rsMid = (WebControl)e.Container.Parent.Parent.Parent;
rsMid.Style["background-image"] = "none";
rsMid.Style["height"] = "14px";
WebControl rsAptContent = (WebControl)e.Container.Parent;
rsAptContent.Style["background-image"] = "none";
rsAptContent.Style["height"] = "14px";
//System.Drawing.Color.or
if (e.Appointment.Description == "1")
rsAptContent.Style["background-color"] = "orange";
else if (e.Appointment.Description == "2")
rsAptContent.Style["background-color"] = "plum";
else if (e.Appointment.Description == "3")
rsAptContent.Style["background-color"] = "lime";
else if (e.Appointment.Description == "4")
rsAptContent.Style["background-color"] = "Yellow";
else if (e.Appointment.Description == "5")
rsAptContent.Style["background-color"] = "royalblue";
else if (e.Appointment.Description == "6")
rsAptContent.Style["background-color"] = "cyan";
else if (e.Appointment.Description == "7")
rsAptContent.Style["background-color"] = "pink";
else if (e.Appointment.Description == "8")
rsAptContent.Style["background-color"] = "maroon";
else if (e.Appointment.Description == "9")
rsAptContent.Style["background-color"] = "blue";
else if (e.Appointment.Description == "10")
rsAptContent.Style["background-color"] = "red";
else if (e.Appointment.Description == "11")
rsAptContent.Style["background-color"] = "orange";
else if (e.Appointment.Description == "12")
rsAptContent.Style["background-color"] = "purple";
else if (e.Appointment.Description == "13")
rsAptContent.Style["background-color"] = "voilet";
e.Appointment.ToolTip = e.Appointment.Subject;
e.Appointment.Subject = "";
}
private void PopulateCalendar()
{
pnl_Calendar.Controls.Clear();
DateTime dt = DateTime.UtcNow;
for (int i = 0; i < numOfMonths; i++)
{
dt = dt.AddMonths(1);
Panel p = new Panel();
RadScheduler rad1 = new RadScheduler();
rad1.ID = "rad" + i.ToString();
rad1.AllowEdit = false;
rad1.AllowInsert = false;
rad1.WeekView.UserSelectable = false;
rad1.DayView.UserSelectable = false;
rad1.MonthView.UserSelectable = false;
rad1.TimelineView.UserSelectable = false;
rad1.Culture = System.Globalization.CultureInfo.CurrentCulture;
rad1.DataEndField = "event_end";
rad1.DataKeyField = "event_ref";
rad1.DataSourceID = "sds_events";
rad1.DataStartField = "event_start";
rad1.DataSubjectField = "event_reference";
rad1.DataDescriptionField = "order_no";
rad1.RowHeight = Unit.Pixel(20);
rad1.ColumnWidth = Unit.Pixel(45);
rad1.Width = Unit.Pixel(335);
/******CALL NOT WORKING
rad1.AppointmentDelete += new AppointmentDeleteEventHandler(RadScheduler1_AppointmentDelete);
/*********WORKING
rad1.AppointmentCreated += new AppointmentCreatedEventHandler(RadScheduler1_AppointmentCreated);
rad1.SelectedView = SchedulerViewType.MonthView;
rad1.OnClientAppointmentClick = "onAppointmentClick";
rad1.Height = Unit.Pixel(575);
rad1.SelectedDate = dt;
rad1.ShowNavigationPane=false;
//popupCalendar.ShowOtherMonthsDays = true;
p.Controls.Add(rad1);
p.Style.Add("float", "left");
p.Style.Add("margin", "0 5px 0 0");
pnl_Calendar.Controls.Add(p);
}
/********** CODE ENDS*******************/
0
Hi Mark,
The problem is in the EventArgs of the AppointmentDelete handler:
The correct event args of the OnAppointmentDelete event are AppointmentDeleteEventArgs.
I just took a look at our help article and I think that it misleads you. There's an error in our help article and we'll do the needful to fix it.
Best wishes,
Veronica Milcheva
the Telerik team
The problem is in the EventArgs of the AppointmentDelete handler:
protected
void
RadScheduler1_AppointmentDelete(
object
sender, Telerik.Web.UI.SchedulerCancelEventArgs e)
{
//...
}
The correct event args of the OnAppointmentDelete event are AppointmentDeleteEventArgs.
I just took a look at our help article and I think that it misleads you. There's an error in our help article and we'll do the needful to fix it.
Best wishes,
Veronica Milcheva
the Telerik team