开发者

Calendar control to show databound date

I have a databound calendar control that load开发者_运维知识库s the date from the database. The problem I have is that it defaults to todays date when the form is loaded, although when you scroll to the loaded date you see that the correct date is in fact selected. How can I force it to show the loaded date from the database from the start?

Thanks


Are you setting the Calendars Visible date?

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.calendar.visibledate.aspx

Gets or sets the DateTime value that specifies the month to display on the Calendar control. The default value is DateTime.MinValue, which displays the month that contains the date specified by TodaysDate.

You know, documentation is made for reading :)


I managed to find a work around. I set the Calendar control's SelectedDate property at design time, and then in the Prerender event of the control, I use the sender's SelectedDate property to set the VisibleDate property of the Control. It then shows both the correct month and correct selected date. :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜