Hi I am Working on ASP.Net 2.0 (C#) .
And Using ASp.Net Calender Control. By default the Week End days are Saturday and Sunday. How can i change these weekend days to Thursday and Friday by conding.
Hi I am Working on ASP.Net 2.0 (C#) .
And Using ASp.Net Calender Control. By default the Week End days are Saturday and Sunday. How can i change these weekend days to Thursday and Friday by conding.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Niradhip ChakrabortyRank #429 · 5.8K reputationPosted Jul 29, 2008, 9:58 PM EDT
You can change the weekend days by assigning different color to it.
Say your weekend days (Saturday and Sunday) are identified by red color now.
You can change it to some other day say Friday by assigning the color.
If you need to make one or more dates in a calendar visually distinctive from regular dates, you can use a set of day styles and associate these styles with particular days. To change appearance of desired days, you need to perform the following:
Create one or more instances of CalendarDayStyle and set their properties (Name, TextColor and TextFont) to desired values
Add the date styles to the collection Calendar.DayStyles
Handle the Calendar.ResolveDayStyle event to associate particular styles with particular days
Here is the sample code that makes every Friday drawn in red:
public Form1()
{
InitializeComponent();
calendar1.DayStyles.Add(new CalendarDayStyle("FridayStyle",
Color.Red, calendar1.DayFont));
calendar1.ResolveDayStyle += Calendar1_ResolveDayStyle;
}
private void Calendar1_ResolveDayStyle(object sender,
ResolveCalendarDayStyleEventArgs e)
{
if (e.Date.DayOfWeek == DayOfWeek.Friday)
e.DayStyleName = "FridayStyle";
}
Abhishek Dhanotia130 reputationPosted Jul 29, 2008, 10:08 PM EDT