Solved

Setting a default date for a calendar

Posted on 2004-08-12
3
277 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

680 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