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

Control in Cell of Month view in Rad Scheduler

6 Answers 109 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Prithvi
Top achievements
Rank 1
Prithvi asked on 28 Sep 2012, 12:38 PM
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

6 Answers, 1 is accepted

Sort by
0
Accepted
Ivana
Telerik team
answered on 01 Oct 2012, 08:13 AM
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.
0
Prithvi
Top achievements
Rank 1
answered on 22 Oct 2012, 02:48 PM
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";
           
        }


    }

0
Boyan Dimitrov
Telerik team
answered on 25 Oct 2012, 02:52 PM
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.
0
Sandy
Top achievements
Rank 1
answered on 10 Oct 2013, 09:04 PM
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 
0
Boyan Dimitrov
Telerik team
answered on 15 Oct 2013, 01:01 PM
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.
0
Sandy
Top achievements
Rank 1
answered on 15 Oct 2013, 04:23 PM
Hi,,
Thank you soo much for your help.
That works for me.
Tags
Scheduler
Asked by
Prithvi
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Prithvi
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Sandy
Top achievements
Rank 1
Share this question
or