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

Problem in apply style to timeslots

7 Answers 99 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
hardik
Top achievements
Rank 1
hardik asked on 29 Mar 2011, 11:08 AM
Hi telerik,

I am using SpecialSlotStyleSelector class .

I have done flowing code.

 this.specialSlots.Add(new Slot(DateTime.Now.AddHours(-7), DateTime.Now)
      {
        RecurrencePattern = new RecurrencePattern(
              null, RecurrenceDays.Monday | RecurrenceDays.Tuesday | RecurrenceDays.Wednesday | RecurrenceDays.Thursday, RecurrenceFrequency.Weekly, 1, null, null)
      });


As per this code Monday to Thursday should be shown with different color.But it not working as per that.It will shows the effect from today's date.(See image)

After some change in code it will work properly.I think this is bug.It is not necessary that i have to pass the date of particular day(monday or tuseday or....).How can i solved this Issue.?

Updated Code
 this.specialSlots.Add(new Slot(DateTime.Now..AddDays(-1).AddHours(-7), DateTime.Now.addDays(-1))
      {
        RecurrencePattern = new RecurrencePattern(
              null, RecurrenceDays.Monday | RecurrenceDays.Tuesday | RecurrenceDays.Wednesday | RecurrenceDays.Thursday, RecurrenceFrequency.Weekly, 1, null, null)
      });


One more thing i have faced that when scheduler load first time at that time scrolling not working after selecting any slot scrolling works.

Thanks
Hardik Pancholi

7 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 01 Apr 2011, 12:30 PM
Hi hardik,

Actually this is expected behavior since you're setting Start DateTime of the Slot.  Special Slots can be created without setting Start and End properties like this:

var slot = new Slot()
{
    IsReadOnly = true,           
    RecurrencePattern = new RecurrencePattern(
            null, RecurrenceDays.Monday | RecurrenceDays.Tuesday | RecurrenceDays.Wednesday | RecurrenceDays.Thursday, RecurrenceFrequency.Weekly, 1, null, null)
};

In this way they will be valid for every Monday- Thursday. Please try it and let us know how it goes.

All the best,
Yana
the Telerik team
0
Mukesh
Top achievements
Rank 1
answered on 01 Apr 2011, 12:59 PM
 hi Yana ,

I am facing same problem

I know i am passing the date here,but my requirement is,  Monday slots should be disable for 12:00 am to 8 :00 am and for 8:00 pm to 12:00 again it is disable.For 8:00 am to 8: pm is should enable.. For all monday in calender.

So Is there any possibilities that I pass only time in slot class?

I have tried to pass default date that is 01-01-0001 its working but problem with that it takes too much time to load.

I can't do something dynamic thing that if monday is render than as per the setting its timeslots get disable.

Thanks
Mukesh
0
Yana
Telerik team
answered on 04 Apr 2011, 03:41 PM
Hi Mukesh,

I suggest you subscribe to VisibleRangeChanged event and get the Start and End date of the VisibleRange property of the RadScheduleView:

private void scheduleView_VisibleRangeChanged(object sender, EventArgs e)
{
    var range = (sender as RadScheduleView).VisibleRange;          
}

then you can update the read-only Slots.
Hope this work-around helps.

Kind regards,
Yana
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
hardik
Top achievements
Rank 1
answered on 08 Apr 2011, 11:39 AM
hi yana,

I have checked with your code.Follwing code I am using .

 Slot readOnlyslot = new Slot()
      { IsReadOnly = true,
        RecurrencePattern = new RecurrencePattern(
                null, RecurrenceDays.Monday | RecurrenceDays.Tuesday , RecurrenceFrequency.Weekly, 1, null, null)
      };
      readOnlyslot.Resources.Add(new Resource("Team", "Calendar"));
      this.readOnlySlots.Add(readOnlyslot);

And I got the result as in image. Is this a bug?If not can you send me sample application for that.

Thanks
Hardik
0
Yana
Telerik team
answered on 13 Apr 2011, 02:13 PM
Hello hardik,

I'm so sorry for my mistake -  actually this is expected behavior,  the Start and End properties of the Slot should  be set when RecurrencePattern is used, because without them the recurrence formula is not applied correctly.

I've attached a simple example to demonstrate how to find the first date of the current week and set it as Start of the read-only slot. Please download the attachment and try it.

Hope this helps.

Regards,
Yana
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
hardik
Top achievements
Rank 1
answered on 14 Apr 2011, 11:31 AM
Hi yana,

Its working fine but when I go to month view at that time it shows the disable slots for Monday,Tuesday and Wednesday. I change  RecurrenceFrequency.Monthly also. Still it shows 3 days for month even though In Your example only Monday and Tuesday is specified in recurrence pattern.

Thanks
Hardik
0
Yana
Telerik team
answered on 15 Apr 2011, 09:54 AM
Hi hardik,

There seems to be a problem with rendering the special slots in MonthView, I've logged the issue and it will be fixed. For now please use the following workaround:

Slot readOnlyslot = new Slot()
{
    Start = startOfWeek,
    End = startOfWeek.AddDays(1).AddMinutes(-1),
    IsReadOnly = true,
    RecurrencePattern = new RecurrencePattern(
    null, RecurrenceDays.Monday | RecurrenceDays.Tuesday , RecurrenceFrequency.Weekly, 1, null, null)
 
};

We're sorry for the inconvenience.

Kind regards,
Yana
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
Tags
ScheduleView
Asked by
hardik
Top achievements
Rank 1
Answers by
Yana
Telerik team
Mukesh
Top achievements
Rank 1
hardik
Top achievements
Rank 1
Share this question
or