How could i make this code work for every year rather only for 2012......... holiday["1/1/2012"] = "New Year"; holiday["1/5/2012"] = "Guru Govind Singh Jayanti"; holiday["1/8/2012"] = "Muharam (Al Hijra)"; holiday["1/14/2012"] = "Pongal"; holiday["1/26/2012"]
= "Republic Day"; holiday["2/23/2012"] = "Maha Shivaratri"; holiday["3/10/2012"] = "Milad un Nabi (Birthday of the Prophet"; holiday["3/21/2012"] = "Holi"; holiday["3/21/2012"] = "Telugu New Year";
Removed year from the key... tried changing this code lab.Text = (string)holidaylist[e.Day.Date.Month]; to lab.Text = (string)holidaylist[e.Day.Date.Month, e.Day.Date.Day]; but getting an error if (holidaylist[e.Day.Date.ToShortDateString()] != null) { Literal
lit = new Literal(); lit.Text = "<br/>"; e.Cell.Controls.Add(lit); Label lab = new Label(); lab.Text = (string)holidaylist[e.Day.Date.Month]; Label1.Font.Size = new FontUnit(FontSize.Small); e.Cell.Controls.Add(lab); }
Error::lab.Text = (string)holidaylist(e.Day.Date.Month, e.Day.Date.Day); 'Calender.holidaylist' is a 'field' but is used like a 'method' protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { if (holidaylist[e.Day.Date.ToShortDateString()]
!= null) { Literal lit = new Literal(); lit.Text = "<br/>"; e.Cell.Controls.Add(lit); Label lab = new Label(); lab.Text = (string)holidaylist(e.Day.Date.Month, e.Day.Date.Day); Label1.Font.Size = new FontUnit(FontSize.Small); e.Cell.Controls.Add(lab); }}
Superguppie.
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.
rookie tiro
Member
86 Points
130 Posts
Calender Control
Feb 13, 2012 04:22 PM|LINK
MetalAsp.Net
All-Star
112032 Points
18231 Posts
Moderator
Re: Calender Control
Feb 13, 2012 05:22 PM|LINK
rookie tiro
Member
86 Points
130 Posts
Re: Calender Control
Feb 14, 2012 03:29 AM|LINK
salman beher...
All-Star
30547 Points
5841 Posts
Re: Calender Control
Feb 14, 2012 04:53 AM|LINK
Hi,
check...
http://forums.asp.net/t/1627219.aspx/1
http://www.aspnet101.com/2008/11/holidays-with-the-calendar-control/
Sincerely,
Salman
vinay13mar
Star
7756 Points
1626 Posts
Re: Calender Control
Feb 14, 2012 04:58 AM|LINK
Hi,
check the link for holiday calender..
http://www.c-sharpcorner.com/uploadfile/d5b8d2/how-to-add-holiday-details-within-calendar-control/
http://www.codeproject.com/Articles/26704/Calendar-control-and-holidays
V.K.Singh
rookie tiro
Member
86 Points
130 Posts
Re: Calender Control
Feb 14, 2012 07:14 AM|LINK
salman beher...
All-Star
30547 Points
5841 Posts
Re: Calender Control
Feb 14, 2012 10:54 AM|LINK
Hi,
it may like..
lab.Text = (string)holidaylist[e.Day.Date.Month, e.Day.Date.Day];
[] instead of ()
try it..
Thanks...
Sincerely,
Salman
rookie tiro
Member
86 Points
130 Posts
Re: Calender Control
Feb 14, 2012 03:31 PM|LINK
rookie tiro
Member
86 Points
130 Posts
Re: Calender Control
Feb 22, 2012 08:38 AM|LINK
superguppie
All-Star
48225 Points
8679 Posts
Re: Calender Control
Feb 24, 2012 08:19 AM|LINK
=>
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.