Solved

Setting a default date for a calendar

Posted on 2004-08-12
3
289 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

717 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