By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,967 Members | 1,167 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,967 IT Pros & Developers. It's quick & easy.

Get the month and year of Calendar that current displaying

P: n/a
How can I get the month and year a calendar control current displaying?

My problem is I want to load a list of event to a calendar so that it
display difference style if there a event for a day.

My initial idea is load all events from database and store it in a
DataTable. In the DayRender event, loop thr the DataTable and see if it equal
to e.Day and alter the style if that is.

However when the event table is large, it hurt performance. So how get I
know what month and year the calendar control is current displaying, thus I
can only load the events of specified month and year only?

Thanks in advance.

Jason
Nov 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Jason Chan" wrote ...
However when the event table is large, it hurt performance. So how get I
know what month and year the calendar control is current displaying, thus
I
can only load the events of specified month and year only?

Thanks in advance.


Hi Jason,

I'm not overly familiar with the calendar control, however, from memory,
cant you access the "selecteditem" - if so, you should be able to get the
date from that - thus breaking it up and getting the month and year...

Again not overly familiar with it - but that should work I think...

Regards

Rob
Nov 23 '05 #2

P: n/a
Calendar.VisibleDate

-Brock
DevelopMentor
http://staff.develop.com/ballen
How can I get the month and year a calendar control current
displaying?

My problem is I want to load a list of event to a calendar so that it
display difference style if there a event for a day.

My initial idea is load all events from database and store it in a
DataTable. In the DayRender event, loop thr the DataTable and see if
it equal to e.Day and alter the style if that is.

However when the event table is large, it hurt performance. So how get
I know what month and year the calendar control is current displaying,
thus I can only load the events of specified month and year only?

Thanks in advance.

Jason

Nov 23 '05 #3

P: n/a
It doesn't work, i have a test.aspx with a Label and a Calendar, with
following code

protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = Calendar1.VisibleDate.ToString();
}

The Label1 show "1/1/0001 0:00:00" when the page first loaded, currently
month/year is Nov, 2005
When I click the nextMonth link, Calendar current displaying Dec, 2005,
however the Label1 show "1/1/0001 0:00:00",
When I click the nextMonth again, The Calendar now is Jan, 2006, but the
Label is "1/12/2005 0:00:00"
Then I click prevMonth, The Calendar back to Dec 2005, the Label shows
"1/1/2006 0:00:00"

It seem the VisibleDate always keep the previous value, and initial
undefined when the page first load.
Anyone can explain the behavior?

Or how you guys implements a event calendar?

Thanks in advance

"Brock Allen" <ba****@NOSPAMdevelop.com>
???????:b8**************************@msnews.micros oft.com...
Calendar.VisibleDate

-Brock
DevelopMentor
http://staff.develop.com/ballen
How can I get the month and year a calendar control current
displaying?

My problem is I want to load a list of event to a calendar so that it
display difference style if there a event for a day.

My initial idea is load all events from database and store it in a
DataTable. In the DayRender event, loop thr the DataTable and see if
it equal to e.Day and alter the style if that is.

However when the event table is large, it hurt performance. So how get
I know what month and year the calendar control is current displaying,
thus I can only load the events of specified month and year only?

Thanks in advance.

Jason


Nov 23 '05 #4

P: n/a
This doesn;t work, since when the page first loaded, no date is selected.
"Rob Meade" <ku***************@edaem.bor> glsD:eF**************@TK2MSFTNGP15.phx.g bl...
"Jason Chan" wrote ...
However when the event table is large, it hurt performance. So how get I
know what month and year the calendar control is current displaying, thus
I
can only load the events of specified month and year only?

Thanks in advance.


Hi Jason,

I'm not overly familiar with the calendar control, however, from memory,
cant you access the "selecteditem" - if so, you should be able to get the
date from that - thus breaking it up and getting the month and year...

Again not overly familiar with it - but that should work I think...

Regards

Rob

Nov 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.