?
Solved

ASP.NET:  Calendar.SelectedDate

Posted on 2004-03-31
4
Medium Priority
?
751 Views
Last Modified: 2012-06-21
[VB.NET]

I have a function that is called from the end of Page_Load() that attempts to initialize the currently-selected date of several Calendar controls.

However, no matter how I try to initialize these Calendars, every time they come up with the current month (March 2004).

What's wrong with what I'm doing here?

Thanks!

         '// This code is always executed, but the calendar always displays with the current month.
         If (Not (dtCreationDate = Nothing)) Then
            '// At this point, dtCreationDate = #6/21/2001#
            sDateFormat = "yyyy/MM/dd"
            Me.calendarCreationDate.SelectedDate = dtCreationDate.ToString(sDateFormat)
         End If

I've tried it just using the DateTime variable, too:

   Me.calendarCreationDate.SelectedDate = dtCreationDate

to no avail.

What do I have to do here to initialize this stupid control?

Thanks!
0
Comment
Question by:bryker
[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
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
KarunSK earned 1000 total points
ID: 10729655
calendarCreationDate.VisibleDate = dtCreationDate
0
 

Author Comment

by:bryker
ID: 10732569

Bingo.

What's SelectedDate for, then?
0
 
LVL 6

Expert Comment

by:KarunSK
ID: 10733974
SelectedDate is the one for getting/setting the date selected. But somebody at MS decided that for some reason you would not want the SelectedDate to be displayed as the default month; so the control displays current month by default, and forces you to override it by setting the VisibleDate property. Don't we love Microsoft? :-)

Karun.
0
 

Author Comment

by:bryker
ID: 10734176

Thanks again.  You've bailed me out 2 times in as many days.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

718 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