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

How to disable time-slots(like 12-4PM)

8 Answers 204 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
prashant
Top achievements
Rank 1
prashant asked on 04 Jun 2010, 01:46 PM
HI All,

I have gone throught the Article http://www.telerik.com/support/kb/aspnet-ajax/scheduler/setting-special-days-or-time-slots-in-radscheduler.aspx

But I have different requirement. I am using Scheduler only for View mode.
Suppose I have created a recurring appointment between 12PM- 4PM for one month.I have to enable Only this slot of (12PM-4PM) enable and all other slots disable.
Please let me know of any other event than TimeSlotCreated.

Thanks
Prashant

8 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 04 Jun 2010, 02:36 PM
Hi Prashant,

If you want to prevent the user from adding new appointments for particlar slot, then you can cancel the OnClientAppointmentInserting event using args.set_cancel(true) after checking for the condition.

Client code:
 
    function OnClientAppointmentInserting(sender, args) {    
        var dt = new Date(); 
        dt = args.get_startTime()
        if (condition) { // check for condition   
            args.set_cancel(true);    
        }    
    } 


Regards,
Shinu.
0
prashant
Top achievements
Rank 1
answered on 04 Jun 2010, 06:42 PM
Hi Shinu,

Thanks for your prompt help..
Can you also suggest me how to Grey out all other slots in that particular day.
For example if a user's appointment for 5th June is for 2PM-4PM then other time slots i.e. 12AM(4 June )-2PM should be grey out and 4 PM-12AM(Now 6 June)) should also be grey out.

Please let me know in this regard.

Thanks
Prashant


0
Peter
Telerik team
answered on 07 Jun 2010, 12:01 PM
Hello prashant,

In TimeSlotCreated you can check the count of the appointments for the current time slot:

protected void  RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
   {
       if (e.TimeSlot.Appointments.Count == 0)
           e.TimeSlot.CssClass = "Disabled";
   }



Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
prashant
Top achievements
Rank 1
answered on 07 Jun 2010, 01:24 PM
Thanks Peter...!!! I had done it also at my end.
However I got stuck in other problem.

Please go through following code.

protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)
        {           
                if (e.TimeSlot.Appointments.Count > 0)
                {
                    e.TimeSlot.CssClass = "HasAppointmentsClass";
                    e.TimeSlot.Control.CssClass = "HasAppointmentsClass";
                    e.TimeSlot.Control.BackColor = System.Drawing.Color.Silver;
                 }
                else
                {
                    e.TimeSlot.CssClass = "Disabled";
                }
        }
I have applied e.TimeSlot.Control.BackColor = System.Drawing.Color.Silver; to ensure that background of timeslot in which there is appointment should also be silver.
I have achieved this also, however onMouseOver this property is getting overridden somewhere.
Please do suggest so that i can override this default behavior.
Please find the file attached.

Thanks
Prashant

0
Peter
Telerik team
answered on 10 Jun 2010, 09:57 AM
Hello Prashant,

If you need to modify the background of the time slots, it is best to use visual style builder to customize your skin. Then set e.TimeSlot.CssClass = "Disabled"; only as an identifier tag for special time slots, but do not define a css rule for this class. 

Alternatively, you can only set the CssClass property for timeslots with appointments:
protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
   {
       {
           if (e.TimeSlot.Appointments.Count > 0)
           {
               e.TimeSlot.CssClass = "HasAppointmentsClass";               
           }
           else
           {
               e.TimeSlot.CssClass = "Disabled";
           }
       }
   }

And define both styles to be the same:
<style type="text/css">
   .Disabled, .HasAppointmentsClass
   {
       background: silver !important;    
   }
   </style>



Greetings,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
prashant
Top achievements
Rank 1
answered on 10 Jun 2010, 11:00 AM
Hi Peter,

Thanks for the suggestion.


Regards
Prashant
0
chinnu
Top achievements
Rank 1
answered on 11 Jul 2012, 04:52 AM
hello prasant

I am having the same requirement.And I am stuck with the same.
Is Your  problem over?
If you dnt mind,can you please give me the code snippet..

Thanks
Chinnu
0
Sen
Top achievements
Rank 1
answered on 14 Mar 2021, 08:57 AM
Do you know how to implement this on vue.js?
Tags
Scheduler
Asked by
prashant
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
prashant
Top achievements
Rank 1
Peter
Telerik team
chinnu
Top achievements
Rank 1
Sen
Top achievements
Rank 1
Share this question
or