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

Setting the cssclass property of a CalenderDay properly

11 Answers 182 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Melvin Lee
Top achievements
Rank 1
Melvin Lee asked on 20 Nov 2007, 09:07 AM
I try to initialize a RadCalendar with special days (holidays, weekends) programmatically. The following code snippet shows how I do it

RadCalendarDay day = new RadCalendarDay(RadCalendar1);
day.Date = DateTime.Today;
day.IsSelectable = false;
day.ItemStyle.CssClass = "outOfRange_Default";
RadCalendar1.SpecialDays.Add(day);

However the rendered HTML is not what I expected. The cell has the following class

<td class="radCalDefault_Default outOfRange_Default">

instead of the following what I would have expected

<td class="outOfRange_Default">

How can I achieve this?

Another question, that is related, how do I tell RadCalendar that weekend days are out of range?

11 Answers, 1 is accepted

Sort by
0
Petja
Telerik team
answered on 21 Nov 2007, 02:42 PM
Hello Marvin Lee,

By default the all calendar style classes are rendered and when there is a css class set to some of its components, both classes are rendered (class="radCalDefault_Default outOfRange_Default") as the settings from the second one overwrite the settings from the first. There is no option so you could render only the class you have set as most of the people just set some color settings and expect to have the same style appearance which come from the first class. This is the reason we render both of them. Let us know what kind or problem you achieve with the both applied css classes and we will advice you further how to proceed.
Concerning making the weekend days out of range days, this is not possible. You could only set MinDate and MaxDate as a valid range, but can not set days in the range to be out of range. We suggest you to set the days to be unselectable and change its css class so they look like the out of range days, which could be achieved by adding the weedend days as SpecialDays as set its property IsSelectable="false" and change its CssClass to be the same as the out of range days.
Let us know if you have further problems.

Sincerely yours,
Petja
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Melvin Lee
Top achievements
Rank 1
answered on 22 Nov 2007, 09:27 AM
Hi,
This is exactly what I'm trying to do with the code snippet that I have added. I tried to give the special days that I have provided the same look & feel as days that are out of range.
This is what I have done. The page where I have added the Calendar control has the EnableTheming property set to true and the theme property set to default. I have set the RangeMinDate and RangeMaxDate properties. Special days that fall between this range should behave like they are out of range. This means they are grey and the mouse pointer should stay an arrow.
However I cannot achieve this by setting the cssclass of the special day or by setting properties like IsSelectable.
0
Petja
Telerik team
answered on 22 Nov 2007, 03:49 PM
Hi Marvin,

Excuse us for this inconvenience. It seems to be an issue concerned with the  css class order which our developers already fixed. Find attached an unofficial hotfix of RadCalendar which addresses the issue. Your Telerik points are updated.
We hope that helps.

Greetings,
Petja
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Melvin Lee
Top achievements
Rank 1
answered on 23 Nov 2007, 10:01 AM

Hi Petja,

I wonder if you have not put up the wrong patch since I'm trying the Prometheus version of the Calendar control.

0
Petja
Telerik team
answered on 26 Nov 2007, 03:08 PM
Hello Marvin,

Excuse us for the misunderstanding. Find attached an unofficial Prometheus suit hotfix.
Let us know if you have further questions.

Regards,
Petja
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Melvin Lee
Top achievements
Rank 1
answered on 27 Nov 2007, 07:51 AM
Hi Petja,
I have tried the patch and according to me it works partially.  The cell is grayed out and I cannot select the special day but when I hover over the cell, the hand cursor is displayed instead of the arrow cursor.
Maybe I have to set another property?
0
Petja
Telerik team
answered on 27 Nov 2007, 09:12 AM
Hello Marvin Lee,

It will be best if you could send us your project with some description what is not working, so we could observe the problem locally and advice you further.

All the best,
Petja
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Melvin Lee
Top achievements
Rank 1
answered on 27 Nov 2007, 09:42 AM
Hi Petja,

How can I send you my test project? I cannot add it to this post as attachment.
 
There is nothing special that I do. What I want is that if I mark that a day is not selectable, I want it to behave like a day that is out of range. To me this means it is grayed out, it is not selectable and if I hover over the cell, the mouse cursor should not change. It should stay the arrow cursor. I cannot make a printscreen of it since the cursor is not shown in the image 
0
Sebastian
Telerik team
answered on 27 Nov 2007, 09:47 AM
Hello Marvin,

You can attach the demo application to a formal support ticket started from your Client.net account. We will test it locally and will get around to you with our findings.

Kind regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mark
Top achievements
Rank 1
answered on 08 Dec 2007, 10:04 AM
This problem seems to affect me as well.  I set special date background color, but it doesn't appear in the calendar 'until' I hover over the cell, then the background color changes to what I expect and remains until I select something or move to another month.
0
Sebastian
Telerik team
answered on 10 Dec 2007, 09:07 AM
Hi Mark,

As suggested previously, attach the demo application to a formal support ticket started from your Client.net account. We will test it locally and will get around to you with our findings.

Regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Calendar
Asked by
Melvin Lee
Top achievements
Rank 1
Answers by
Petja
Telerik team
Melvin Lee
Top achievements
Rank 1
Sebastian
Telerik team
Mark
Top achievements
Rank 1
Share this question
or