I am creating my webday views in my code behind as follows:
{
// create the Info object (key to the scheduling)
// create the SQL provider
myInfo.ID = "WebScheduleInfo_" + dr["DataText"].ToString().Replace(" ", "").Replace(".", "");
// set the active resource
// set some forms
//myInfo.GetAppointmentsForDate(currentResource, WebCalendar1.SelectedDate);
myInfo.ReminderFormPath = "../SchedulerFiles/Reminder.aspx";
// and link the data provider to the info
mySQLCP.WebScheduleInfo = myInfo;
// now connect the SQL provider
// create a day view
myDayView.ID = "WebDayView_" + dr["DataText"].ToString().Replace(" ","").Replace(".","");
// link the day view to the info
myDayView.WebScheduleInfo = myInfo;
// put an identifier on the day view
myDayView.ScrollPosition = -1;
myDayView.WorkingTimeSlotStyle.BackColor = Utilities.GetExaminerColor(dr["DataValue"].ToString());
myDayView.TimeSlotLabelStyle.Width = 40;
myDayView.Width = 160;
myDayView.Height = 380;
}
else
myDayView.Width = 120;
myDayView.EnableAutoActivityDialog = true;
bFirstResource = false;
// Add the day view to the place holder
phTimeSlots.Controls.Add(myDayView);
phTimeSlots.Controls.Add(myInfo);
phTimeSlots.Controls.Add(mySQLCP);
mySQLCP.DataBind();
This creates all my webdayviews but I need to add an event handler for when the client adds, updates or deletes an appointment. If a drag and drop the WebScheduleInfo on to a page I can hookup the event handler by going to the properties tab and adding on the events the handler for ActivityAdded, ActivityDeleted and ActivityUpdated which in the code view makes the WebScheduleInfo look like this:
onactivityadded="WebScheduleInfo_SaveAppealsInfo"
onactivityupdated="WebScheduleInfo_SaveAppealsInfo">
</igsch:WebScheduleInfo>
How to I do this same thing in the code behind? I have tried to do something like:
myInfo.Attributes.Add("onactivityupdated", "WebScheduleInfo_SaveAppealsInfo");
myInfo.Attributes.Add("onactivitydeleted", "WebScheduleInfo_DeleteAppealsInfo");
but it doesn't work. It doesn't fire the WebScheduleInfo_SaveAppealsInfo code in the code behind once the Add, Update or Delete fires.
Any help would be appreicated.
Thanks!
Never mind I found it....
I just need to do it this way
myInfo.ActivityUpdated += new ActivityUpdatedEventHandler(this.WebScheduleInfo_SaveAppealsInfo);
myInfo.ActivityDeleted += new ActivityDeletedEventHandler(this.WebScheduleInfo_DeleteAppealsInfo);