Get the month and year of Calendar that current displaying

Discussion in 'ASP .Net' started by =?Utf-8?B?SmFzb24gQ2hhbg==?=, Nov 23, 2005.

  1. 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
     
    =?Utf-8?B?SmFzb24gQ2hhbg==?=, Nov 23, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?SmFzb24gQ2hhbg==?=

    Rob Meade Guest

    "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
     
    Rob Meade, Nov 23, 2005
    #2
    1. Advertising

  3. =?Utf-8?B?SmFzb24gQ2hhbg==?=

    Brock Allen Guest

    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
    >
     
    Brock Allen, Nov 23, 2005
    #3
  4. =?Utf-8?B?SmFzb24gQ2hhbg==?=

    Jason Chan Guest

    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" <>
    ???????:...
    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
    >
     
    Jason Chan, Nov 23, 2005
    #4
  5. =?Utf-8?B?SmFzb24gQ2hhbg==?=

    Jason Chan Guest

    This doesn;t work, since when the page first loaded, no date is selected.


    "Rob Meade" <> ¼¶¼g©ó¶l¥ó·s»D:eF$...
    "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
     
    Jason Chan, Nov 23, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tfsmag
    Replies:
    8
    Views:
    495
    Kim Quigley
    Jun 17, 2005
  2. Replies:
    1
    Views:
    453
    Steve W. Jackson
    Dec 22, 2006
  3. Mufasa
    Replies:
    0
    Views:
    404
    Mufasa
    Sep 5, 2008
  4. Ken Fine
    Replies:
    4
    Views:
    138
    Evertjan.
    Apr 5, 2004
  5. Replies:
    7
    Views:
    218
    Idgarad
    Oct 6, 2006
Loading...

Share This Page