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

How to Allow and don't allow insert for Rad Scheduler for particular time slot

3 Answers 280 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Venkateswara
Top achievements
Rank 1
Venkateswara asked on 02 Aug 2011, 08:04 AM
Hi all,
I have develop a Telerik Radscheduler in that i have write the code like below in iwant disable/Enable the perticuler time-slot for an event,in this disable is working fine but enable not working i can't understand why it is not enable to allow-insert.please help me where i need to change to resolve this problem...


            protected void RadScheduler1_TimeSlotCreated1(object sender, TimeSlotCreatedEventArgs e)
      {


        //Getting Business hour time
        mybusinesscalendarEntities objEntity = new mybusinesscalendarEntities();
        var Result = from bhours in objEntity.businesshours where bhours.BusinessId == businessid select bhours;
        if (Result.Count() > 0)
        {
            var Hours = (from bhours in objEntity.businesshours where bhours.BusinessId == businessid select bhours).First();
           


            //Get particular day businee hour timings and disable the time slot 


            string Day = System.DateTime.Today.DayOfWeek.ToString();
            if (Day == "Monday")
            {
                string WorkDay = Hours.MondayFromTime.Value.ToShortTimeString();
                string WorkDayStart = WorkDay.Remove(WorkDay.Length - 2, 2);
                string WorkDayEnd = Hours.MondayToTime.Value.ToShortTimeString();
                string WorkDayEndTime = WorkDayEnd.Remove(WorkDayEnd.Length - 2, 2);
                if ((e.TimeSlot.Start.TimeOfDay < TimeSpan.Parse(WorkDayStart.Trim())) || (e.TimeSlot.Start.TimeOfDay > TimeSpan.Parse(WorkDayEndTime.Trim())))
                {
                    e.TimeSlot.CssClass = "Disabled";
                    RadScheduler1.ReadOnly = true;
                }


                else


                {
                  
                    RadScheduler1.ReadOnly = false;
                    RadScheduler1.AllowInsert = true;
                    RadScheduler1.AllowEdit = true;
                    RadScheduler1.AllowDelete = true;
                    
                }

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 02 Aug 2011, 09:20 AM
hello venkateswararao,

if ((e.TimeSlot.Start.TimeOfDay < TimeSpan.Parse(WorkDayStart.Trim())) || (e.TimeSlot.Start.TimeOfDay > TimeSpan.Parse(WorkDayEndTime.Trim())))
                {
                    e.TimeSlot.CssClass = "Disabled";
                    RadScheduler1.ReadOnly = true;
                }

In this condition you define whole RadScheduler as readonly so you are not allowed to insert.
please remove this (RadScheduler1.ReadOnly = true;) line from your code and check.

let me know is any concern.

Thanks,
Jayesh Goyani
0
Venkateswara
Top achievements
Rank 1
answered on 02 Aug 2011, 09:37 AM
Hi,

Thanks for your replay i want to deny that condition in else part i want to allow insert please help me How can i resolve
0
Peter
Telerik team
answered on 03 Aug 2011, 02:29 PM
Hello Venkateswararao,

Please, see this article - http://www.telerik.com/support/kb/aspnet-ajax/scheduler/setting-special-days-or-time-slots-in-radscheduler.aspx

Note that you should not set RadScheduler properties in the else part because they will affect the entiry control, not only the current time slot. The javascript from the kb article above is sufficient to disable a time slot.

Greetings,
Peter
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.

Tags
General Discussions
Asked by
Venkateswara
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Venkateswara
Top achievements
Rank 1
Peter
Telerik team
Share this question
or