[RESOLVED] Select specific date on calendar
I want a specific date to be selected on my calendar. MSDN advises to use the property SelectedDate (http://msdn.microsoft.com/en-us/libr...sd(VS.71).aspx) but that isnt recognized in my C# app!
Code:
myCalendar.SelectedDate = employee.BirthDate;
Instead I used this:
Code:
myCalendar.TodayDate = employee.BirthDate;
The problem with this is that it states that TODAYS date is the employees birth date. I however want it to state that the selected day is the employees birth date without the words "today: " infront of it. Is this possible? I tried using the method setDate but I am not too sure how it works...
Re: Select specific date on calendar
What's wrong with the 'SelectedDate' property? What do you mean when you say "but that isn't recognized in my C#"? Do you get a compilation error? If you don't get a compilation error then what happens? If you don't get a compilation error do you mind posting more of the code where you are setting the 'SelectedDate'? Thanks.
1 Attachment(s)
Re: Select specific date on calendar
The dropdown list doesnt contain "SelectedDate" and it is not recognized when I type it manually! I attached a screenshot (sorry, its all in German!).
Re: Select specific date on calendar
Good. Now you can answer another question. Is this an ASP.NET application or a Windows application? The MSDN link you had earlier is for the web Calendar...By the look of it you are writing a Windows application so that link doesn't apply...
Re: Select specific date on calendar
Re: Select specific date on calendar
I managed to make SetDate() work using the following code:
Code:
calBirthDate.SetDate(lTrainee.BirthDate);
I still find it strange that SelectedDate isnt accessible from windows.forms!
Re: Select specific date on calendar
Quote:
Originally Posted by
stephsh
I still find it strange that SelectedDate isnt accessible from windows.forms!
Although they may be similar, the System.Web.UI.WebControls.Calendar class is not the same as the System.Windows.Forms.MonthCalendar class. This is why they do not have the same properties.
Re: Select specific date on calendar
Quote:
Originally Posted by
foamy
That's a good point foamy but I would expect the authors of the library to have a consistency when it comes to common elements. A text box has a Text property whether it is a Windows TextBox or an ASP.net Text Box. Nevertheless the library is what it is so the best thing to do is follow the documentation for the target library:)