C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...









Adjust ASP.NET CalendarControl to show Next Month


Posted Date: 06 Jun 2008    Resource Type: Code Snippets    Category: Date & Time

Posted By: Raju.M       Member Level: Gold
Rating:     Points: 7



The code sample written in C# changes to set a month value to the next month.

When we place a Calendar Control in ASP.NET page, its shows the current date, by default. But to set the date shown in the calendar control to a date in the next month we just need to set the CalendarControl's TodaysDate property to a date in the next month.

To obtain a date in the next month dynamically, we just Add a month to the current date. Further, the current date is easily obtained using the static DateTime.Now property.



DateTime nextMonth = DateTime.Now.AddMonths(1); //Add a month
Calendar1.TodaysDate = nextMonth; // Set today's date to nextmonth
DateTime nextOfNextMonth = DateTime.Now.AddMonths(2);//Add two months
Calendar2.TodaysDate = nextOfNextMonth; //Set today's date to month after next





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
TodaysDate property of CalendarControl  .  Setting TodaysDate of CalendarControl in ASP.NET  .  CalendarControl's TodaysDate property  .  ASP.NET C# Calendar Control to show Next Month  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to get the Last day of month
Previous Resource: How to Convert date format from MM/dd/yyyy to dd/MM/yyyy
Return to Discussion Resource Index
Post New Resource
Category: Date & Time


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

silicone halloween mask

Contact Us    Privacy Policy    Terms Of Use