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

[Solved] Reload radcalendar on checkbox check/uncheck in RadPanelItem

3 Answers 141 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 16 May 2009, 01:14 PM
Hi 

I have a number of checkboxes within a radpanelitem each one loads a different set of data.
I have enabled the radcalendar to show if there is anything going on on that day by makling the day show in bold. the problem is, that when i check or uncheck any of these boxes that data changes , which is correct, but i cant get the radcalendar to refresha at the same time, this  causing the calendar formatting to be incorrect as it may show that there is still something happening on that day , when i have jclearly ust unchecked the item to remove that data from the scheduler.

Is there a way to refresh this calendar when checking or unchecking?

Thanks

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 18 May 2009, 11:05 AM
Hello Greg,

I wasn't able to understand your scenario, could you please send us a simple project illustrating the issue? You should open a support ticket in order to be able to attach files. Thanks

Best regards,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Andrew
Top achievements
Rank 1
answered on 18 May 2009, 12:50 PM
Hi

I have created a custom checkbox , and when it is checked it shows specific appointments . I have also got the calendar linked into this so when going through the list of appointments it changes the calendar day to bold should there be an appointment on that day. When i uncheck the checkbox it removes the appointments from the scheduler but it doesnt update the calendar. How can i refesh the calendar when checking/unchecking my custom checkbox?

Thanks
 
 
public partial class modules_Admissions_calendars_calendars :SecurePage  
{  
   
    /// <summary> 
    /// telerik stuff  
    /// </summary> 
    private const string ProviderSessionKey = " modules_Admissions_calendars_calendars";  
    //private Dictionary<int, string> checkBoxIDs;  
    public List<Appointment> appointments = new List<Appointment>();  
    DateTime dteSelectedDate = new DateTime();  
    RadCalendar selectionCalendar;  
    string datetimeFilter;  
 
    #region Page Events  
 
    /// <summary> 
    /// PreInit  
    /// </summary> 
    /// <param name="sender"></param> 
    /// <param name="e"></param> 
    protected void Page_PreInit(object sender, EventArgs e)  
    {  
        MSM = new iSAMS.Security.ModuleSecurityManager("ISAMS_ADMISSIONSMANAGER", Global.SystemVars.SYS_UserSecurity);  
         
    }  
              
    /// <summary> 
    /// Init  
    /// </summary> 
    /// <param name="sender"></param> 
    /// <param name="e"></param> 
    protected void Page_Init(object sender, EventArgs e)  
    {  
        //telerik stuff  
   
        RegisterClientScripts();  
 
        WireUpControls();  
 
        ApplyStyling();  
 
    }  
 
    /// <summary> 
    /// Load  
    /// </summary> 
    /// <param name="sender"></param> 
    /// <param name="e"></param> 
    protected void Page_Load(object sender, EventArgs e)  
    {  
 
        RadScheduler1.DataKeyField = "ID";  
        RadScheduler1.DataStartField = "Start";  
        RadScheduler1.DataEndField = "End";  
        RadScheduler1.DataSubjectField = "Subject";  
        RadScheduler1.DataRecurrenceField = "RecurrenceRule";  
        RadScheduler1.DataRecurrenceParentKeyField = "RecurrenceParentID";  
 
        if (!IsPostBack)  
        {  
            datetimeFilter = DateTime.Now.ToShortDateString();  
            RadScheduler1.SelectedView = SchedulerViewType.DayView;  
        }  
        else  
        {  
            datetimeFilter = RadCalendar1.SelectedDate.ToShortDateString();  
        }  
 
        BindData();                  
          
    }  
    
    #endregion Page Events  
 
    #region UI Generation  
 
    /// <summary> 
    /// This method contains all client script registration  
    /// </summary> 
    private void RegisterClientScripts()  
    {  
 
    }  
    /// <summary> 
    /// This method wires up control events and properties  
    /// </summary> 
    private void WireUpControls()  
    {  
        // TODO : Wire up controls HERE (e.g. btn.Click += new EventHandler(btn_Click);)  
 
        RadScheduler1.AppointmentCreated += new AppointmentCreatedEventHandler(RadScheduler1_AppointmentCreated);  
        RadScheduler1.AppointmentUpdate +=new AppointmentUpdateEventHandler(RadScheduler1_AppointmentUpdate);  
 
        RadCalendar1.DayRender += new Telerik.Web.UI.Calendar.DayRenderEventHandler(RadCalendar1_DayRender);  
        RadCalendar1.SelectionChanged +=new SelectedDatesEventHandler(RadCalendar1_SelectionChanged);  
 
    }  
 
 
    protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)  
    {  
        DateTime CurrentDate = e.Day.Date;  
        if (findDates(CurrentDate))  
        {  
            e.Cell.Style["font-weight"] = "bold";  
        }  
    }  
 
    protected bool findDates(DateTime theDate)  
    {  
 
        CheckBox chkBox1 = PanelBarMarketingCheckboxes.FindControl("chkVisits") as CheckBox;  
        if (chkBox1.Checked)  
        {  
            AdmissionsVisitsService avService = new AdmissionsVisitsService();  
            using (TList<AdmissionsVisits> avList = avService.GetAll())  
            {  
 
                //avList.ApplyFilter(a => !a.TxtVisitDateTime.Equals(theDate.ToShortDateString()),false);  
 
                avList.ApplyFilter(delegate(AdmissionsVisits a)  
                {  
                    if (!String.IsNullOrEmpty(a.TxtVisitDateTime.ToString()))  
                    {  
                        DateTime dateTimeShort = DateTime.Parse(a.TxtVisitDateTime.ToString());  
                        return dateTimeShort.ToShortDateString().Equals(theDate.ToShortDateString());  
                    }  
                    else  
                    {  
                        return false;  
                    }  
 
                }, false);  
 
                if (avList.Count != 0)  
                    return true;  
            }  
        }  
 
        CheckBox chkBox2 = PanelBarMarketingCheckboxes.FindControl("chkInterviews") as CheckBox;  
        if (chkBox2.Checked)  
        {  
 
            AdmissionInterviewNoteService ainService = new AdmissionInterviewNoteService();  
            using (TList<AdmissionInterviewNote> ainList = ainService.GetAll())  
            {  
                ainList.ApplyFilter(delegate(AdmissionInterviewNote a)   
                {  
 
                    if (!String.IsNullOrEmpty(a.DteInterviewDateTime.ToString()))  
                    {  
                        DateTime dateTimeShort = DateTime.Parse(a.DteInterviewDateTime.ToString());  
                        return dateTimeShort.ToShortDateString().Equals(theDate.ToShortDateString());  
                    }  
                    else  
                    {  
                        return false;  
                    }  
 
                }, false);  
 
                if (ainList.Count != 0)  
                    return true;  
            }  
        }  
         
        CheckBox chkBox3 = PanelBarPupilCheckboxes.FindControl("chkDOB") as CheckBox;  
        if (chkBox3.Checked)  
        {  
            PupilManagementPupilsService pmpService = new PupilManagementPupilsService();  
            using (TList<PupilManagementPupils> pmpList = pmpService.GetAll())  
            {  
                pmpList.ApplyFilter(delegate(PupilManagementPupils p)   
                {   
           
                    if (!String.IsNullOrEmpty(p.TxtDob.ToString()))  
                    {  
                        DateTime dateTimeShort = DateTime.Parse(p.TxtDob.ToString());  
                        return dateTimeShort.ToShortDateString().Equals(theDate.ToShortDateString());  
                    }  
                    else  
                    {  
                        return false;  
                    }  
 
                }, false);  
 
                if (pmpList.Count != 0)  
                    return true;  
            }  
 
        }  
 
        CheckBox chkBox4 = PanelBarPupilCheckboxes.FindControl("chkRegistered") as CheckBox;  
        if (chkBox4.Checked)  
        {   
            PupilManagementPupilsService pmpService = new PupilManagementPupilsService();  
            using (TList<PupilManagementPupils> pmpList = pmpService.GetAll())  
            {  
                pmpList.ApplyFilter(delegate(PupilManagementPupils p)   
                {   
                    if (!String.IsNullOrEmpty(p.TxtRegisteredDate.ToString()))  
                    {  
                        DateTime dateTimeShort = DateTime.Parse(p.TxtRegisteredDate.ToString());  
                        return dateTimeShort.ToShortDateString().Equals(theDate.ToShortDateString());  
                    }  
                    else  
                    {  
                        return false;  
                    }  
 
                }, false);  
                    if (pmpList.Count != 0)  
                        return true;             
            }  
 
        }  
 
        CheckBox chkBox5 = PanelBarPupilCheckboxes.FindControl("chkEnquiry") as CheckBox;  
        if (chkBox5.Checked)  
        {   
            PupilManagementPupilsService pmpService = new PupilManagementPupilsService();  
            using (TList<PupilManagementPupils> pmpList = pmpService.GetAll())  
            {  
                pmpList.ApplyFilter(delegate(PupilManagementPupils p)   
                {   
                    if (!String.IsNullOrEmpty(p.TxtEnquiryDate.ToString()))  
                    {  
                        DateTime dateTimeShort = DateTime.Parse(p.TxtEnquiryDate.ToString());  
                        return dateTimeShort.ToShortDateString().Equals(theDate.ToShortDateString());  
                    }  
                    else  
                    {  
                        return false;  
                    }  
 
                }, false);  
                    if (pmpList.Count != 0)  
                        return true;             
 
            }  
          
        }  
 
        CheckBox chkBox6 = PanelBarPupilCheckboxes.FindControl("chkProspectus") as CheckBox;  
        if (chkBox6.Checked)  
        {  
              AdmissionsProspectusService apService = new AdmissionsProspectusService();  
            using (TList<AdmissionsProspectus> apList = apService.GetAll())  
            {  
                apList.ApplyFilter(delegate(AdmissionsProspectus a)   
                {   
   
                    if (!String.IsNullOrEmpty(a.DteDateSent.ToString()))  
                    {  
                        DateTime dateTimeShort = DateTime.Parse(a.DteDateSent.ToString());  
                        return dateTimeShort.ToShortDateString().Equals(theDate.ToShortDateString());  
                    }  
                    else  
                    {  
                        return false;  
                    }  
                  
                }, false);  
                if (apList.Count != 0)  
                        return true;             
 
            }    
        }  
 
        CheckBox chkBox7 = PanelBarPupilCheckboxes.FindControl("chkWithdrawn") as CheckBox;  
        if (chkBox7.Checked)  
        {  
            PupilManagementPupilsService pmpService = new PupilManagementPupilsService();  
            using (TList<PupilManagementPupils> pmpList = pmpService.GetAll())  
            {  
                pmpList.ApplyFilter(delegate(PupilManagementPupils p)   
                {   
 
                    if (!String.IsNullOrEmpty(p.TxtWithdrawnDate.ToString()))  
                    {  
                        DateTime dateTimeShort = DateTime.Parse(p.TxtWithdrawnDate.ToString());  
                        return dateTimeShort.ToShortDateString().Equals(theDate.ToShortDateString());  
                    }  
                    else  
                    {  
                        return false;  
                    }  
                  
                }, false);  
                    if (pmpList.Count != 0)  
                        return true;             
 
            }  
        }  
 
        CheckBox chkBox8 = PanelBarPupilCheckboxes.FindControl("chkRejected") as CheckBox;  
        if (chkBox8.Checked)  
        {  
             PupilManagementPupilsService pmpService = new PupilManagementPupilsService();  
            using (TList<PupilManagementPupils> pmpList = pmpService.GetAll())  
            {  
                pmpList.ApplyFilter(delegate(PupilManagementPupils p)   
                {   
 
                    if (!String.IsNullOrEmpty(p.TxtRejectedDate.ToString()))  
                    {  
                        DateTime dateTimeShort = DateTime.Parse(p.TxtRejectedDate.ToString());  
                        return dateTimeShort.ToShortDateString().Equals(theDate.ToShortDateString());  
                    }  
                    else  
                    {  
                        return false;  
                    }  
                  
                }, false);  
                    if (pmpList.Count != 0)  
                        return true;             
 
            }  
        }    
 
        return false;  
      
    }  
 
    /// <summary> 
    /// This method retrieves any data from the database and generates the appropriate UI content  
    /// </summary> 
    private void BindData()  
    {  
        appointments = new List<Appointment>();  
 
        CheckBox chkBox1 = PanelBarMarketingCheckboxes.FindControl("chkVisits") as CheckBox;  
        if (chkBox1.Checked)  
        {             
            showVisits();  
        }  
 
        CheckBox chkBox2 = PanelBarMarketingCheckboxes.FindControl("chkInterviews") as CheckBox;  
        if (chkBox2.Checked)  
        {  
            showInterviews();  
        }  
 
        CheckBox chkBox3 = PanelBarPupilCheckboxes.FindControl("chkDOB") as CheckBox;  
        if (chkBox3.Checked)  
        {             
            ShowPupilDetails("DOB");  
        }  
 
        CheckBox chkBox4 = PanelBarPupilCheckboxes.FindControl("chkRegistered") as CheckBox;  
        if (chkBox4.Checked)  
        {  
            ShowPupilDetails("REGISTERED");  
        }  
 
        CheckBox chkBox5 = PanelBarPupilCheckboxes.FindControl("chkEnquiry") as CheckBox;  
        if (chkBox5.Checked)  
        {   
            ShowPupilDetails("ENQUIRY");  
        }  
 
        CheckBox chkBox6 = PanelBarPupilCheckboxes.FindControl("chkProspectus") as CheckBox;  
        if (chkBox6.Checked)  
        {  
            ShowPupilDetails("PROSPECTUS");  
        }  
 
        CheckBox chkBox7 = PanelBarPupilCheckboxes.FindControl("chkWithdrawn") as CheckBox;  
        if (chkBox7.Checked)  
        {  
            ShowPupilDetails("WITHDRAWN");  
        }  
 
        CheckBox chkBox8 = PanelBarPupilCheckboxes.FindControl("chkRejected") as CheckBox;  
        if (chkBox8.Checked)  
        {  
            ShowPupilDetails("REJECTED");  
        }    
    
        RadScheduler1.DataSource = appointments;  
        RadScheduler1.DataBind();                    
   
    }  
    /// <summary> 
    /// This method retrieves any data from the database and generates the appropriate UI content  
    /// </summary> 
 
    private void showVisits()  
    {  
        Trace.Warn(RadScheduler1.SelectedView.ToString());  
        AdmissionsVisitsService avService = new AdmissionsVisitsService();  
        using (TList<AdmissionsVisits> avList = avService.GetAll())  
        {  
            foreach (AdmissionsVisits avItem in avList)  
            {  
 
                if (RadScheduler1.SelectedView != SchedulerViewType.DayView)  
                {  
                    Appointment appointment = new Appointment("Visit_" + avItem.TblAdmissionsVisitsId.ToString(), avItem.TxtVisitDateTime, avItem.TxtVisitDateTime, avItem.TxtNote.ToString());  
                    appointment.Attributes["customTitle"] = "Visit: " + GetPupilName(avItem.TxtSchoolid.ToString());  
                    appointments.Add(appointment);  
                }  
       
            }  
 
        }  
      
    }  
 
    private void showInterviews()  
    {  
 
        AdmissionInterviewNoteService ainService = new AdmissionInterviewNoteService();  
        using (TList<AdmissionInterviewNote> ainList = ainService.GetAll())  
        {  
              foreach (AdmissionInterviewNote ainItem in ainList)  
            {  
                DateTime dteInterviewDateTime;  
                string txtDate = "";  
                string txtTime = "";  
                string[] arrayDateTime;  
                  
                txtDate = ainItem.DteInterviewDateTime.ToString();  
                arrayDateTime = txtDate.Split(' ');  
                txtDate = arrayDateTime[0].ToString();  
                txtTime = arrayDateTime[1].ToString();  
     
                dteInterviewDateTime = DateTime.Parse(txtDate + " " + txtTime);  
 
                Appointment appointment = new Appointment("Interview_" + ainItem.TxtSchoolId.ToString(), dteInterviewDateTime, dteInterviewDateTime, "No Interview Notes Available");  
                appointment.Attributes["customTitle"] = "Interview: " + GetPupilName(ainItem.TxtSchoolId.ToString());  
                appointments.Add(appointment);  
                  
            }  
 
        }          
 
    }  
 
    private void ShowPupilDetails(string txtType)  
    {  
 
        PupilManagementPupilsService pmpService = new PupilManagementPupilsService();  
              
        //all the information that comes from the same table  
        using (TList<PupilManagementPupils> pmpList = pmpService.GetAll())  
        {  
             
            foreach (PupilManagementPupils pmpItem in pmpList)  
            {  
                DateTime dteHolderDateTime = new DateTime();  
                DateTime dteHolderEndDateTime = new DateTime();  
                string txtDate = "";  
                string txtTime = "";  
                string txtNote = "";  
                string[] arrayDateTime;  
                Appointment appointment = new Appointment();  
 
                switch (txtType)  
                {   
                    case "DOB":  
 
                        if (!String.IsNullOrEmpty(pmpItem.TxtDob.ToString()))                   
                        {  
                            txtDate = pmpItem.TxtDob.ToString();  
                            arrayDateTime = txtDate.Split(' ');  
                            txtDate = arrayDateTime[0].ToString();  
                            txtTime = arrayDateTime[1].ToString();  
   
                            if (txtTime == "00:00:00")  
                            {                                 
                                dteHolderDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                                dteHolderEndDateTime = DateTime.Parse(txtDate + " " + txtTime).AddDays(01);                                 
                            }  
                            else                               
                            {  
                                dteHolderDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                                dteHolderEndDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                            }  
 
                            appointment = new Appointment("DOB_" + pmpItem.TxtSchoolId.ToString(), dteHolderDateTime, dteHolderEndDateTime, dteHolderDateTime.ToString());  
                            appointment.Attributes["customTitle"] = "DOB: " + GetPupilName(pmpItem.TxtSchoolId.ToString()); ;  
                            appointments.Add(appointment);  
                                  
                        }  
 
                    break;  
 
                    case "REGISTERED":  
 
                    if (!String.IsNullOrEmpty(pmpItem.TxtRegisteredDate.ToString()))  
                    {  
                        txtDate = pmpItem.TxtRegisteredDate.ToString();  
                        arrayDateTime = txtDate.Split(' ');  
                        txtDate = arrayDateTime[0].ToString();  
                        txtTime = arrayDateTime[1].ToString();  
 
                        if (txtTime == "00:00:00")  
                        {  
                            dteHolderDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                            dteHolderEndDateTime = DateTime.Parse(txtDate + " " + txtTime).AddDays(01);  
                        }  
                        else  
                        {  
                            dteHolderDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                            dteHolderEndDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                        }  
 
                        appointment = new Appointment("Registered_" + pmpItem.TxtSchoolId.ToString(), dteHolderDateTime, dteHolderEndDateTime, "No Registered Notes");  
                        appointment.Attributes["customTitle"] = "Registered: " + GetPupilName(pmpItem.TxtSchoolId.ToString());  
                        appointments.Add(appointment);  
                    }  
 
                    break;  
 
                    case "ENQUIRY":  
 
                    if (!String.IsNullOrEmpty(pmpItem.TxtEnquiryDate.ToString()))  
                    {  
                        txtDate = pmpItem.TxtEnquiryDate.ToString();  
                        //txtNote = pmpItem.TxtEnquiryType.ToString();  
 
                        arrayDateTime = txtDate.Split(' ');  
                        txtDate = arrayDateTime[0].ToString();  
                        txtTime = arrayDateTime[1].ToString();  
 
                        if (txtTime == "00:00:00")  
                        {  
                            dteHolderDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                            dteHolderEndDateTime = DateTime.Parse(txtDate + " " + txtTime).AddDays(01);  
                        }  
                        else  
                        {  
                            dteHolderDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                            dteHolderEndDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                        }  
 
                        appointment = new Appointment("Enquiry_" + pmpItem.TxtSchoolId.ToString(), dteHolderDateTime, dteHolderEndDateTime, "No Enquiry Notes");  
                        appointment.Attributes["customTitle"] = "Enquiry: " + GetPupilName(pmpItem.TxtSchoolId.ToString());  
                        appointments.Add(appointment);  
                    }  
                        
                    break;  
                  
                    case "WITHDRAWN":  
 
                    if (!String.IsNullOrEmpty(pmpItem.TxtWithdrawnDate.ToString()))  
                    {  
                        txtDate = pmpItem.TxtWithdrawnDate.ToString();  
                        txtNote = "Reason : " + pmpItem.TxtWithdrawnReason.ToString() + "<BR><BR>Note:" + pmpItem.TxtWithdrawnReasonNote.ToString();  
 
                        arrayDateTime = txtDate.Split(' ');  
                        txtDate = arrayDateTime[0].ToString();  
                        txtTime = arrayDateTime[1].ToString();  
 
                        if (txtTime == "00:00:00")  
                        {  
                            dteHolderDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                            dteHolderEndDateTime = DateTime.Parse(txtDate + " " + txtTime).AddDays(01);  
                        }  
                        else  
                        {  
                            dteHolderDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                            dteHolderEndDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                        }  
 
                        appointment = new Appointment("Withdrawn_" + pmpItem.TxtSchoolId.ToString(), dteHolderDateTime, dteHolderEndDateTime, "No Withdrawn Notes");  
                        appointment.Attributes["customTitle"] = "Withdrawn: " + GetPupilName(pmpItem.TxtSchoolId.ToString());  
                        appointments.Add(appointment);  
                    }  
 
                    break;  
 
                    case "REJECTED":  
                    if (!String.IsNullOrEmpty(pmpItem.TxtRejectedDate.ToString()))  
                    {  
                        txtDate = pmpItem.TxtRejectedDate.ToString();  
                        txtNote = "Reason : " + pmpItem.TxtRejectedReason.ToString() + "<BR><BR>Note:" + pmpItem.TxtRejectedReasonNote.ToString();  
 
                        arrayDateTime = txtDate.Split(' ');  
                        txtDate = arrayDateTime[0].ToString();  
                        txtTime = arrayDateTime[1].ToString();  
 
                        if (txtTime == "00:00:00")  
                        {  
                            dteHolderDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                            dteHolderEndDateTime = DateTime.Parse(txtDate + " " + txtTime).AddDays(01);  
                        }  
                        else  
                        {  
                            dteHolderDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                            dteHolderEndDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                        }  
 
                        appointment = new Appointment("Rejected_" + pmpItem.TxtSchoolId.ToString(), dteHolderDateTime, dteHolderEndDateTime, "No Rejected Notes");  
                        appointment.Attributes["customTitle"] = "Rejected: " + GetPupilName(pmpItem.TxtSchoolId.ToString());  
                        appointments.Add(appointment);  
                    }  
                    break;  
 
                    default:  
 
                    break;  
 
                }  
                
 
            }              
 
        }  
 
  switch (txtType)  
        {  
           
         case "PROSPECTUS":  
         AdmissionsProspectusService apService = new AdmissionsProspectusService();  
         using (TList<AdmissionsProspectus> apList = apService.GetAll())  
         {  
            foreach (AdmissionsProspectus apItem in apList)  
            {  
                DateTime dteHolderDateTime = new DateTime();  
                DateTime dteHolderEndDateTime = new DateTime();  
                string txtDate = "";  
                string txtTime = "";  
                string txtNote = "";  
                string[] arrayDateTime;  
                Appointment appointment = new Appointment();  
 
                if (!String.IsNullOrEmpty(apItem.DteDateSent.ToString()))  
                {  
                    txtDate = apItem.DteDateSent.ToString();                  
 
                    arrayDateTime = txtDate.Split(' ');  
                    txtDate = arrayDateTime[0].ToString();  
                    txtTime = arrayDateTime[1].ToString();  
 
                    if (txtTime == "00:00:00")  
                    {  
                        dteHolderDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                        dteHolderEndDateTime = DateTime.Parse(txtDate + " " + txtTime).AddDays(01);  
                    }  
                    else  
                    {  
                        dteHolderDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                        dteHolderEndDateTime = DateTime.Parse(txtDate + " " + txtTime);  
                    }  
 
                    appointment = new Appointment("Prospectus_" + apItem.TxtSchoolid.ToString(), dteHolderDateTime, dteHolderEndDateTime, "No Prospectus Notes");  
                    appointment.Attributes["customTitle"] = "Prospectus Sent: " + GetPupilName(apItem.TxtSchoolid.ToString());  
                    appointments.Add(appointment);  
                }  
 
            }  
           
         }  
         break;  
        }  
             
    }  
 
    public string GetPupilName(string txtPupilID)  
    {  
         
        string txtPupilName = "";  
        PupilManagementPupilsService pmpService = new PupilManagementPupilsService();  
        using (PupilManagementPupils pmpItem = pmpService.GetByTxtSchoolId(txtPupilID))  
        {  
 
            if (pmpItem != null)  
            {  
 
                if (!String.IsNullOrEmpty(pmpItem.TxtFullName) && pmpItem.TxtFullName.ToString() != "0")  
                {                  
                    txtPupilName = pmpItem.TxtFullName.ToString();                      
                }  
                else   
                {                 
                    txtPupilName = "Unknown";     
                }  
            }  
            else  
            {  
                txtPupilName = "Unknown";  
            }  
        }        
 
        return txtPupilName;  
 
    }  
 
    /// <summary> 
    /// This method applies styling attributes to page elements and controls  
    /// </summary> 
    private void ApplyStyling()  
    {  
 
    }  
 
    #endregion UI Generation  
 
    #region Control Events  
 
    #endregion Control Events  
 
    #region Server-Side Validation  
 
    #endregion Server-Side Validation  
 
    #region Error Handling  
 
    /// <summary> 
    /// Displays a critical error to the user  
    /// </summary> 
    /// <param name="message">Error message</param> 
    private void DoCriticalError(string message)  
    {  
        DoCriticalError(message, true);  
    }  
 
    /// <summary> 
    /// Displays a critical error to the user  
    /// </summary> 
    /// <param name="message">Error message</param> 
    /// <param name="_bStopProcessing">Boolean to stop the processing</param> 
    private void DoCriticalError(string message, bool stopProcessing)  
    {  
        infCriticalError.ContentText = message;  
        tblCriticalError.Visible = true;  
 
    }  
 
    #endregion Error Handling  
 
    #region Telerik functions  
    protected void RadScheduler1_NavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e)  
    {         
        RadCalendar1.FocusedDate = RadScheduler1.SelectedDate;         
    }  
 
 
    protected void RadCalendar1_SelectionChanged(object sender, SelectedDatesEventArgs e)  
    {  
        if (RadCalendar1.SelectedDates.Count > 0)  
        {  
            RadScheduler1.SelectedDate = RadCalendar1.SelectedDate;   
 
            if (RadScheduler1.SelectedView == SchedulerViewType.MonthView)  
            {  
                RadScheduler1.SelectedView = SchedulerViewType.DayView;  
            }  
        }  
 
        datetimeFilter = RadCalendar1.SelectedDate.ToShortDateString();  
    }  
 
    protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)  
    {  
          
    }  
 
    protected void RadScheduler1_AppointmentDelete(object sender, SchedulerCancelEventArgs e)  
    {  
        RadCalendar1.SpecialDays.Clear();  
 
 
    }  
 
    protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)  
    {  
        RadCalendar1.SpecialDays.Clear();  
 
        string[] arrayAppointmentItem;  
 
        arrayAppointmentItem = e.ModifiedAppointment.ID.ToString().Split('_');  
 
 
        switch (GetTypeFromID(e.Appointment.ID.ToString()))  
        {  
            case "VISIT":  
 
                AdmissionsVisitsService avService = new AdmissionsVisitsService();  
                using (AdmissionsVisits avItem = avService.GetByTblAdmissionsVisitsId(Int32.Parse(arrayAppointmentItem[1])))  
                {  
                    avItem.TxtVisitDateTime = e.ModifiedAppointment.Start;  
                    avItem.TxtSubmitBy = iSAMS.Runtime.Context.Current.LoggedInUser.TxtUserCode;  
                    avItem.TxtSubmitDateTime = DateTime.Today;  
 
                    avService.Save(avItem);  
                  
                }  
 
                break;  
            case "INTERVIEW":  
 
                PupilManagementPupilsService pmpService = new PupilManagementPupilsService();  
                using (PupilManagementPupils pmpItem = pmpService.GetByTxtSchoolId(arrayAppointmentItem[1].ToString()))  
                {  
                    pmpItem.TxtInterviewDate = e.ModifiedAppointment.Start;  
                    pmpItem.TxtInterviewTime = e.ModifiedAppointment.Start.ToShortTimeString();  
                    pmpItem.TxtSubmitBy = iSAMS.Runtime.Context.Current.LoggedInUser.TxtUserCode;  
                    pmpItem.TxtSubmitDateTime = DateTime.Now;  
 
                    pmpService.Save(pmpItem);  
 
                }  
 
                break;          
        }  
    
        BindData();  
 
 
    }  
 
    protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)  
    {  
 
          }  
 
    protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)  
    {  
 
        RadCalendar1.SpecialDays.Clear();  
 
        switch (GetTypeFromID(e.Appointment.ID.ToString()))  
        {  
            case "VISIT":  
                e.Appointment.CssClass = "rsCategoryGreen ";  
                break;  
            case "INTERVIEW":  
                e.Appointment.CssClass = "rsCategoryDarkBlue ";  
                break;  
            case "DOB":  
                e.Appointment.CssClass = "disableDelete rsCategoryBlue";             
                break;  
            case "REGISTERED":  
                e.Appointment.CssClass = "disableDelete rsCategoryDarkGreen";                 
                break;  
            case "ENQUIRY":  
                e.Appointment.CssClass = "disableDelete rsCategoryDarkRed";               
                break;  
            case "PROSPECTUS":  
                e.Appointment.CssClass = "disableDelete rsCategoryOrange";  
                break;  
            case "WITHDRAWN":  
                e.Appointment.CssClass = "disableDelete rsCategoryViolet";  
                break;  
            case "REJECTED":  
                e.Appointment.CssClass = "disableDelete rsCategoryYellow";  
                break;  
        }  
    }  
 
    protected void RadScheduler1_FormCreated(object sender,SchedulerFormCreatedEventArgs e)  
    {  
          
        if (e.Container.Mode == SchedulerFormMode.Insert)  
        {  
              
            DropDownList ddlList = (DropDownList)e.Container.FindControl("ddlCalendarTypes");  
              
            ListItem liItem1 = new ListItem();  
            liItem1.Value="1";  
            liItem1.Text = "Visit";  
 
            ddlList.Items.Add(liItem1);   
   
            ListItem liItem2 = new ListItem();  
            liItem2.Value = "2";  
            liItem2.Text = "Interview";  
 
            ddlList.Items.Add(liItem2);                             
        }  
    }  
 
    private string GetTypeFromID(string ID)  
    {  
 
        string[] arrayAppointmentItem;  
        string txtAppointmentType = "";  
 
        arrayAppointmentItem = ID.ToString().Split('_');  
 
        txtAppointmentType = arrayAppointmentItem[0].ToUpper();  
 
        return txtAppointmentType;  
      
    }  
    
    protected void CheckBoxes_CheckedChanged(object sender, EventArgs e)  
    {  
     
    }  
          
    #endregion  
 
    /// <summary> 
    /// definitions used for the telerik stuff  
    /// </summary> 
 
 
}  
 
 
 
 
 
 
 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="calendars.aspx.cs" Inherits="modules_Admissions_calendars_calendars"  Trace="true"%> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
 
<style type="text/css">    
    .disableDelete .rsAptDelete    
    {    
        display: none;    
    }      
</style>    
</head> 
<body style="background-color: White" > 
    <form id="form1" runat="server" > 
    <Telerik:RadScriptManager runat="Server" ID="RadScriptManager1" /> 
 
    <script type="text/javascript">  
 
        var intCalendarWidth = 0;  
        var intCalendarHeight = 0;  
          
        /* Firefox resize scrollable content */  
        function hideScrollableArea(sender, eventArgs) {  
            if ($telerik.isFirefox)  
                $telerik.$('.rsContentScrollArea').css('overflow', 'hidden');  
        }  
        function showScrollableArea(sender, eventArgs) {  
            if ($telerik.isFirefox)  
                $telerik.$('.rsContentScrollArea').css('overflow', 'auto');  
        }  
 
        function OnClientAppointmentEditing(sender, eventArgs)   
        {  
            var appointmentObject = eventArgs.get_appointment();  
 
            arrayAppointmentID = appointmentObject.get_id().split('_');  
 
            if (arrayAppointmentID[0].toUpperCase() != "INTERVIEW" && arrayAppointmentID[0].toUpperCase() != "VISIT")   
            {  
                eventArgs.set_cancel(true);  
            }  
            else   
            {  
                eventArgs.set_cancel(false);  
            }              
 
        }  
 
        function OnClientAppointmentMoveStart(sender, eventArgs)   
        {  
            var appointmentObject = eventArgs.get_appointment();  
 
            arrayAppointmentID = appointmentObject.get_id().split('_');  
     
            if (arrayAppointmentID[0].toUpperCase() != "INTERVIEW" && arrayAppointmentID[0].toUpperCase() != "VISIT")   
            {  
                eventArgs.set_cancel(true);  
            }  
            else   
            {  
                eventArgs.set_cancel(false);  
            }  
 
        }  
 
    </script> 
         
    <Telerik:RadAjaxManager runat="Server" ID="RadAjaxManager1" > 
        <AjaxSettings> 
                <Telerik:AjaxSetting AjaxControlID="RadCalendar1">  
                <UpdatedControls>                   
                <Telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
                </Telerik:AjaxSetting> 
 
                <Telerik:AjaxSetting AjaxControlID="RadCalendar2">  
                <UpdatedControls> 
                <Telerik:AjaxUpdatedControl ControlID="RadCalendar1" /> 
                <Telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
                </Telerik:AjaxSetting> 
 
                <Telerik:AjaxSetting AjaxControlID="chkVisits">  
                <UpdatedControls> 
                <Telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
                </Telerik:AjaxSetting> 
 
                <Telerik:AjaxSetting AjaxControlID="chkInterviews">  
                <UpdatedControls> 
                <Telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
                </Telerik:AjaxSetting> 
 
                <Telerik:AjaxSetting AjaxControlID="chkDOB">  
                <UpdatedControls> 
                <Telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
                </Telerik:AjaxSetting> 
 
                <Telerik:AjaxSetting AjaxControlID="chkRegistered">  
                <UpdatedControls> 
                 <Telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
                </Telerik:AjaxSetting> 
                  
                <Telerik:AjaxSetting AjaxControlID="chkEnquiry">  
                <UpdatedControls> 
                <Telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
                </Telerik:AjaxSetting> 
                  
                <Telerik:AjaxSetting AjaxControlID="chkProspectus">  
                <UpdatedControls> 
                <Telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
                </Telerik:AjaxSetting> 
                  
                <Telerik:AjaxSetting AjaxControlID="chkWithdrawn">  
                <UpdatedControls> 
                <Telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
                </Telerik:AjaxSetting> 
                  
                <Telerik:AjaxSetting AjaxControlID="chkRejected">  
                <UpdatedControls> 
                <Telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
                </Telerik:AjaxSetting> 
                  
                <Telerik:AjaxSetting AjaxControlID="RadScheduler1">  
                <UpdatedControls> 
                <Telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
                </Telerik:AjaxSetting> 
              
        </AjaxSettings> 
    </Telerik:RadAjaxManager> 
    <Telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Office2007"/>  
 
        <Telerik:RadSplitter runat="server" ID="RadSplitter1" PanesBorderSize="0" Width="100%" Height="100%" Skin="Office2007" >                     
          
                <!-- the scheduler view --> 
                <Telerik:RadPane runat="Server" ID="leftPane" Scrolling="None">   
                <div style="padding:10px 0px 10px 10px;">  
                    <Telerik:RadScheduler Culture="en-GB" runat="server" ID="RadScheduler1" Skin="Office2007" EnableEmbeddedSkins="True" 
                        ShowFooter="true"  DayStartTime="08:00:00" DayEndTime="21:00:00" 
                        TimeZoneOffset="00:00:00" OverflowBehavior="Expand" Height="100%" 
                        TimelineView-UserSelectable="false" OnNavigationComplete="RadScheduler1_NavigationComplete" 
                        OnAppointmentDelete="RadScheduler1_AppointmentDelete" SelectedView="MonthView" 
                        OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" OnAppointmentInsert="RadScheduler1_AppointmentInsert" 
                        FirstDayOfWeek="Monday" LastDayOfWeek="Friday" CustomAttributeNames="customTitle" OnClientAppointmentEditing="OnClientAppointmentEditing"    
                        OnClientAppointmentMoveStart="OnClientAppointmentMoveStart" ShowAllDayRow="true" OnFormCreated="RadScheduler1_FormCreated" 
                        MinimumInlineFormWidth="300" MinimumInlineFormHeight="150" MinutesPerRow="15" TimeLabelRowSpan="1" HoursPanelTimeFormat="HH:mm:tt" MonthView-VisibleAppointmentsPerDay="5" > 
                        <AppointmentTemplate> 
                            <asp:Label ID="lblTitle" runat="server"><%# Eval("customTitle") %></asp:Label>   
                        </AppointmentTemplate>   
                        <InlineInsertTemplate> 
                           <div id="InlineInsertTemplate">  
                            <table width="100%" border="0">  
                                <tr>                                  
                                    <td align="right">Note</td>                             
                                    <td> 
                                        <asp:TextBox ID="txtboxNote" runat="server" TextMode="MultiLine" Width="100%" Height="50px"></asp:TextBox> 
                                    </td> 
                                </tr> 
                                <tr> 
                                    <td align="right">Appointment Type</td> 
                                    <td> 
                                        <asp:DropDownList ID="ddlCalendarTypes" runat="server"></asp:DropDownList> 
                                    </td> 
                                </tr> 
                                <tr> 
                                    <td colspan="2" align="right">  
                                        <table> 
                                            <tr> 
                                                <td> 
                                                      <iSAMS:iSAMSButton ID="InsertButton" runat="server" CommandName="Insert" Text="Submit"/></iSAMS:iSAMSButton> 
                                                </td> 
                                                <td>&nbsp</td>                         
                                                <td> 
                                                      <iSAMS:iSAMSButton ID="CancelButton" runat="server" CommandName="Insert" Text="Cancel"/></iSAMS:iSAMSButton> 
                                                </td> 
                                            </tr> 
                                        </table> 
                                    </td> 
                                </tr> 
                            </table> 
                                  
                           </div> 
                        </InlineInsertTemplate>   
                                                 
                    </Telerik:RadScheduler>                  
                    </div>             
                </Telerik:RadPane>                
 
              <Telerik:RadPane runat="Server" ID="RightPane" Width="240px" MinWidth="240" MaxWidth="240"   
                    Scrolling="None" OnClientBeforeResize="hideScrollableArea" OnClientResized="showScrollableArea" 
                    OnClientBeforeExpand="hideScrollableArea" OnClientExpanded="showScrollableArea" 
                    OnClientBeforeCollapse="hideScrollableArea" OnClientCollapsed="showScrollableArea" > 
                      <div style="padding:10px">  
                    <div class="calendar-container" align="center" style="padding-bottom:10px"<!--  holds the calendar--> 
                      
                        <Telerik:RadCalendar runat="server" ID="RadCalendar1" Skin="Office2007" AutoPostBack="true" 
                            EnableMultiSelect="false" DayNameFormat="FirstTwoLetters" EnableNavigation="true" 
                            EnableMonthYearFastNavigation="false" OnSelectionChanged="RadCalendar1_SelectionChanged" 
                            Width="220px" > 
                        </Telerik:RadCalendar> 
                          
                    </div> 
                      
                     <!-- the checkbox selectors --> 
                    <Telerik:RadPanelBar runat="server" Skin="Office2007" ID="PanelBarMarketing" Width="100%">     
                        <Items>                            
                            <Telerik:RadPanelItem runat="server" Text="Marketing" Expanded="true" Width="100%">  
                                <Items> 
                                    <Telerik:RadPanelItem runat="server" ID="PanelBarMarketingCheckboxes">  
                                        <ItemTemplate> 
                                            <div> 
                                                <div> 
                                                    <asp:CheckBox ID="chkVisits" runat="server" Text="Visits" Checked="true" AutoPostBack="true" 
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" /> 
                                                </div> 
                                                <div> 
                                                    <asp:CheckBox ID="chkInterviews" runat="server" Text="Interviews" Checked="true" AutoPostBack="true" 
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" /> 
                                                </div> 
                                            </div> 
                                        </ItemTemplate> 
                                    </Telerik:RadPanelItem> 
                                </Items> 
                            </Telerik:RadPanelItem> 
                        </Items> 
                    </Telerik:RadPanelBar> 
                     <Telerik:RadPanelBar runat="server" Skin="Office2007" ID="PanelBarPupil" Width="100%">     
                        <Items>                            
                            <Telerik:RadPanelItem runat="server" Text="Pupil" Expanded="true">  
                                <Items> 
                                    <Telerik:RadPanelItem runat="server" ID="PanelBarPupilCheckboxes" > 
                                        <ItemTemplate> 
                                            <div> 
                                                <div > 
                                                    <asp:CheckBox ID="chkDOB" runat="server" Text="DOB" Checked="true" AutoPostBack="true" 
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" /> 
                                                </div> 
                                                <div> 
                                                    <asp:CheckBox ID="chkRegistered" runat="server" Text="Registered" Checked="true" AutoPostBack="true" 
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" /> 
                                                </div> 
                                                <div> 
                                                    <asp:CheckBox ID="chkEnquiry" runat="server" Text="Enquiry" Checked="true" AutoPostBack="true" 
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" /> 
                                                </div> 
                                                 <div> 
                                                    <asp:CheckBox ID="chkProspectus" runat="server" Text="Propsectus Sent" Checked="true" AutoPostBack="true" 
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" /> 
                                                </div> 
                                                <div> 
                                                    <asp:CheckBox ID="chkWithdrawn" runat="server" Text="Withdrawn" Checked="true" AutoPostBack="true" 
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" /> 
                                                </div> 
                                                <div> 
                                                    <asp:CheckBox ID="chkRejected" runat="server" Text="Rejected" Checked="true" AutoPostBack="true" 
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" /> 
                                                </div> 
                                            </div> 
                                        </ItemTemplate> 
                                    </Telerik:RadPanelItem> 
                                </Items> 
                            </Telerik:RadPanelItem> 
                        </Items> 
                    </Telerik:RadPanelBar> 
                     </div>      
                </Telerik:RadPane> 
                  
        </Telerik:RadSplitter> 
 
    <!-- Critical Error Display --> 
    <table id="tblCriticalError" runat="server" width="100%" height="100%" visible="false">  
        <tr> 
            <td> 
                <iSAMS:InfoTable runat="server" ID="infCriticalError" StyleType="PageError" HeadingText="The following error occurred:" /> 
            </td> 
        </tr> 
    </table> 
    <asp:HiddenField ID="hiddenWidth" runat="server" Value="" /> 
    <asp:HiddenField ID="hiddenHeight" runat="server" Value="" /> 
    </form> 
</body> 
</html> 
 
0
T. Tsonev
Telerik team
answered on 18 May 2009, 03:10 PM
Hello Greg,

Thank you for sending the source code. At first sight it looks like the AJAX settings might need a little tweaking. At the moment the checkboxes don't directly update the calendars:

<Telerik:AjaxSetting AjaxControlID="chkVisits"> 
<UpdatedControls>
<Telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</Telerik:AjaxSetting>

Maybe you should include them here?

An easy way to rule out such problems is to disable the AJAX updates temporarily:
<telerik:RadAjaxManager EnableAJAX="false" ...>

Let us know if that helps.

Best wishes,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Scheduler
Asked by
Andrew
Top achievements
Rank 1
Answers by
Yana
Telerik team
Andrew
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or