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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhishek DhanotiaPosted Jul 30, 2008, 2:08 AM
Niradhip ChakrabortyPosted Jul 30, 2008, 1:58 AM
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";
}