Solved

Setting a default date for a calendar

Posted on 2004-08-12
3
266 Views
Last Modified: 2010-04-15
Anyone know how to set System.Web.UI.WebControls.Calendar to today's date?

and also how do I parse a dateTime value from the database to set the calendar?
0
Comment
Question by:jayrod
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
jkrill earned 250 total points
ID: 11788489
System.Web.UI.WebControls.Calendar cal = new System.Web.UI.WebControls.Calendar();
cal.SelectedDate = DateTime.Now;

And to parse a DateTime string:

string myDateAsString = "1/1/2004";
DateTime aDate = DateTime.Parse(myDateAsString);
0
 
LVL 3

Author Comment

by:jayrod
ID: 11792163
once I reparse and get aDate.. can I use it the same way I use DateTime.Now to reset the calendar?
0
 
LVL 2

Expert Comment

by:jkrill
ID: 11793491
Yes.  DateTime.Now simply returns a DateTime object initialized with the current date and time.
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question