Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to show holidays in a different color in calendar web server control?

Reply
Thread Tools

How to show holidays in a different color in calendar web server control?

 
 
Simon
Guest
Posts: n/a
 
      06-19-2008
By default, days in the calendar control are simply displayed as numbers, I
want to show some days in a different color in this control. What is the
best way to do that?

Thanks very much.

 
Reply With Quote
 
 
 
 
Munna
Guest
Posts: n/a
 
      06-19-2008
Hi

Do subscribe the DayRender event of the calender control...
and change your style
here is a simple code snippet

protected void Calendar1_DayRender(object sender, DayRenderEventArgs
e)
{
if (e.Day.IsWeekend)
{
e.Cell.BackColor = Color.Red;
}
}

Best of luck

Munna
www.munna.shatkotha.com
www.munna.shatkotha.com/blog
www.shatkotha.com
 
Reply With Quote
 
 
 
 
Steven Cheng [MSFT]
Guest
Posts: n/a
 
      06-19-2008
Hi Simon,

As for Calendar control, I think the best place to perform the
customization is using "DayRender" event. In this event, you can get the
current Cell being rendered. And you can check the DateTime and then do
some customization on the cell. For example:

========================
Protected Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender

If e.Day.Date.Day Mod 5 = 1 Then

e.Cell.BackColor = System.Drawing.Color.Yellow

End If

End Sub
========================

For your case, what you need to do is write a function to check whether it
is holiday based on the DateTime value. Then, chang the background or
foreground color.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
http://www.velocityreviews.com/forums/(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Reply-To: "Simon" <(E-Mail Removed)>
>From: "Simon" <(E-Mail Removed)>
>Subject: How to show holidays in a different color in calendar web server

control?
>Date: Thu, 19 Jun 2008 14:29:00 +0800


>
>By default, days in the calendar control are simply displayed as numbers,

I
>want to show some days in a different color in this control. What is the
>best way to do that?
>
>Thanks very much.
>
>


 
Reply With Quote
 
Simon
Guest
Posts: n/a
 
      06-20-2008
Thank you, Steven. You are always so helpful. Thanks to Munna too.


"Steven Cheng [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Simon,
>
> As for Calendar control, I think the best place to perform the
> customization is using "DayRender" event. In this event, you can get the
> current Cell being rendered. And you can check the DateTime and then do
> some customization on the cell. For example:
>
> ========================
> Protected Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
>
> If e.Day.Date.Day Mod 5 = 1 Then
>
> e.Cell.BackColor = System.Drawing.Color.Yellow
>
> End If
>
> End Sub
> ========================
>
> For your case, what you need to do is write a function to check whether it
> is holiday based on the DateTime value. Then, chang the background or
> foreground color.
>
> Hope this helps.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> (E-Mail Removed).
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscripti...t/default.aspx.
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> --------------------
>>Reply-To: "Simon" <(E-Mail Removed)>
>>From: "Simon" <(E-Mail Removed)>
>>Subject: How to show holidays in a different color in calendar web server

> control?
>>Date: Thu, 19 Jun 2008 14:29:00 +0800

>
>>
>>By default, days in the calendar control are simply displayed as numbers,

> I
>>want to show some days in a different color in this control. What is the
>>best way to do that?
>>
>>Thanks very much.
>>
>>

>


 
Reply With Quote
 
Steven Cheng [MSFT]
Guest
Posts: n/a
 
      06-20-2008
You're welcome Simon,

Have a nice day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Reply-To: "Simon" <(E-Mail Removed)>
>In-Reply-To: <(E-Mail Removed)>
>Subject: Re: How to show holidays in a different color in calendar web

server control?
>Date: Fri, 20 Jun 2008 11:28:41 +0800


>Thank you, Steven. You are always so helpful. Thanks to Munna too.
>
>
>"Steven Cheng [MSFT]" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> Hi Simon,
>>
>> As for Calendar control, I think the best place to perform the
>> customization is using "DayRender" event. In this event, you can get the
>> current Cell being rendered. And you can check the DateTime and then do
>> some customization on the cell. For example:
>>
>> ========================
>> Protected Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As
>> System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
>>
>> If e.Day.Date.Day Mod 5 = 1 Then
>>
>> e.Cell.BackColor = System.Drawing.Color.Yellow
>>
>> End If
>>
>> End Sub
>> ========================
>>
>> For your case, what you need to do is write a function to check whether

it
>> is holiday based on the DateTime value. Then, chang the background or
>> foreground color.
>>
>> Hope this helps.
>>
>> Sincerely,
>>
>> Steven Cheng
>>
>> Microsoft MSDN Online Support Lead
>>
>>
>> Delighting our customers is our #1 priority. We welcome your comments and
>> suggestions about how we can improve the support we provide to you.

Please
>> feel free to let my manager know what you think of the level of service
>> provided. You can send feedback directly to my manager at:
>> (E-Mail Removed).
>>
>> ==================================================
>> Get notification to my posts through email? Please refer to
>>

http://msdn.microsoft.com/subscripti...ult.aspx#notif
>> ications.
>>
>> Note: The MSDN Managed Newsgroup support offering is for non-urgent

issues
>> where an initial response from the community or a Microsoft Support
>> Engineer within 1 business day is acceptable. Please note that each

follow
>> up response may take approximately 2 business days as the support
>> professional working with you may need further investigation to reach the
>> most efficient resolution. The offering is not appropriate for situations
>> that require urgent, real-time or phone-based interactions or complex
>> project analysis and dump analysis issues. Issues of this nature are best
>> handled working with a dedicated Microsoft Support Engineer by contacting
>> Microsoft Customer Support Services (CSS) at
>> http://msdn.microsoft.com/subscripti...t/default.aspx.
>> ==================================================
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> --------------------
>>>Reply-To: "Simon" <(E-Mail Removed)>
>>>From: "Simon" <(E-Mail Removed)>
>>>Subject: How to show holidays in a different color in calendar web server

>> control?
>>>Date: Thu, 19 Jun 2008 14:29:00 +0800

>>
>>>
>>>By default, days in the calendar control are simply displayed as numbers,

>> I
>>>want to show some days in a different color in this control. What is the
>>>best way to do that?
>>>
>>>Thanks very much.
>>>
>>>

>>

>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Calendar GadGets does not show calendar iccsi Windows 64bit 4 08-14-2011 01:52 PM
Holidays in Calendar Extendar Anjut Software 1 10-26-2009 11:05 AM
Changing font color from current font color to black color Kamaljeet Saini Ruby 0 02-13-2009 04:58 PM
show calendar show clock tony Cisco 1 09-18-2006 07:13 AM



Advertisments