Control in Cell of Month view in Rad Scheduler

7 posts, 1 answers
  1. Prithvi
    Prithvi avatar
    5 posts
    Member since:
    Sep 2012

    Posted 28 Sep 2012 Link to this post

    Hi All,

    I have Facing the Problem Related to the rad scheduler, I want add control [Like check box] in cell of Moth view.
    But there is no option in rad scheduler.....
    Pls  Help me its so urgent.

    Thanks 
    Prithvi
  2. Answer
    Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 01 Oct 2012 Link to this post

    Hello Prithvi,

    The following online demo shown an application scenario of customized time slots in month view: http://demos.telerik.com/aspnet-ajax/scheduler/examples/customizetimeslots/defaultcs.aspx.

    I hope you will find it helpful.

    Kind regards,
    Ivana
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Prithvi
    Prithvi avatar
    5 posts
    Member since:
    Sep 2012

    Posted 22 Oct 2012 Link to this post

    Thanks lvana, it worked for me. but now i have one issue in same. Now i am able to CheckBox in cell but now i need the CheckedChanged event for that checkbox and want to get clicked appointment because i want to disable that day where we click on checkbox.

    I am getting conversion error on this line for my code : SchedulerAppointmentContainer appContainer = (SchedulerAppointmentContainer)CompletedStatusCheckBox.Parent;

    I agree we can't convert like this but then how can i get the appointment. Please suggest 

    here is my code which i have implement :

     protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)
      {
    if (RadScheduler1.SelectedView == SchedulerViewType.MonthView && (e.TimeSlot.CssClass != "Disabled" && e.TimeSlot.CssClass != "notSelectable"))
            {


                CheckBox chk = new CheckBox();
                chk.Checked = false;
                chk.Text = "Close";
                chk.AutoPostBack = true;
                chk.CheckedChanged += new EventHandler(chk_CheckedChanged);
                chk.Attributes.Add("date", e.TimeSlot.Start.Date.ToShortDateString());
                e.TimeSlot.Control.Controls.Add(chk);
            }

    }

    void chk_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox CompletedStatusCheckBox = (CheckBox)sender; 
                //Find the appointment object to directly interact with it
                SchedulerAppointmentContainer appContainer = (SchedulerAppointmentContainer)CompletedStatusCheckBox.Parent;
                Appointment appointment = appContainer.Appointment;
                Appointment appointmentToUpdate = RadScheduler1.PrepareToEdit(appointment, RadScheduler1.EditingRecurringSeries);
                if (CompletedStatusCheckBox.Checked)
            {
                appointment.CssClass = "notSelectable";
               
            }


        }

  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 25 Oct 2012 Link to this post

    Hello Prithvi,

    I did modify the provided code in order to demonstrate the desired functionality:

    protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
        {
            if (RadScheduler1.SelectedView == SchedulerViewType.MonthView && (e.TimeSlot.CssClass != "Disabled" && e.TimeSlot.CssClass != "notSelectable"))
            {
                ................
                chk.Attributes.Add("Start", e.TimeSlot.Start.Ticks.ToString());
                chk.Attributes.Add("End", e.TimeSlot.End.Ticks.ToString());
                e.TimeSlot.Control.Controls.Add(chk);
            }
        }

    protected void chk_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox CompletedStatusCheckBox = (CheckBox)sender;
             
            IList<Appointment> currentAppCollection = RadScheduler1.Appointments.GetAppointmentsInRange(new DateTime(long.Parse(CompletedStatusCheckBox.Attributes["Start"])), new DateTime(long.Parse(CompletedStatusCheckBox.Attributes["End"])));
            if (CompletedStatusCheckBox.Checked)
            {
                foreach (Appointment currentApp in currentAppCollection)
                {
                    Appointment appointmentToUpdate = RadScheduler1.PrepareToEdit(currentApp, RadScheduler1.EditingRecurringSeries);
                    currentApp.CssClass = "notSelectable";
                }
                 
            }
        }

    You can also find attached a sample project that implements this scenario.

    Hope that this will lead you into right direction.

    Regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Sandy
    Sandy avatar
    26 posts
    Member since:
    Mar 2012

    Posted 10 Oct 2013 Link to this post

    Hi,

    In appointment click event I entered this step to get the date of the cell which I clicked
    but every time it is giving me the Current date(Todays date.)
    DateTime SelectedDate = RadScheduler1.SelectedDate;

    Please help me.
    Thank you 
  7. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 15 Oct 2013 Link to this post

    Hello,

    An easy and convenient way to retrieve the date of the clicked appointment would be:
    //markup code
    <telerik:RadScheduler runat="server" ID="RadScheduler1"  OnAppointmentClick="RadScheduler1_AppointmentClick">         
    </telerik:RadScheduler>
    //code behind
    protected void RadScheduler1_AppointmentClick(object sender, SchedulerEventArgs e)
        {
            DateTime selectedDate = e.Appointment.Start;
        }


    Regards,
    Boyan Dimitrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  8. Sandy
    Sandy avatar
    26 posts
    Member since:
    Mar 2012

    Posted 15 Oct 2013 Link to this post

    Hi,,
    Thank you soo much for your help.
    That works for me.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017