Force Calendar Control to "Re-Bind"

Posted on 2006-04-19
Last Modified: 2008-01-09
There are several posts on this, but I'm still having some issues.

I want to build a web page that allows a user to select a project from a drop down.  When they select the project, my form goes to the database to get all of the due dates associated with the project and I use the DayRender event to populate the calendar.  I can get this to work on the first page load by getting my data in the Page_Load event, then the DayRender event fires and fills the calendar.  How can I get this to work when the user selects a value from a drop down?

I tried this code from another post:  (Code was added to a Button Click event)

        Dim DREg As System.Web.UI.WebControls.DayRenderEventArgs
        Calendar1_DayRender(sender, DREg)

..but this does not work.  The DayRender event gets fired, but the error indicates that the "e" event arg variable has not been created.  How can I solve this?
Question by:tfewster949
    LVL 23

    Expert Comment

    If you are handling DayRender event then you should be getting this event called during post back too. You should not have to force the call into this event.
    If you remove your forced call to dayrender event, Does your calendar show up on post back or not?

    Author Comment

    OK, I think I'm getting somewhere.

    1) I have a DataTable variable that has scope across the entire page.
    2) On Page_Load, I fill the DataTable with data on project schedule dates from the database.  I only do this on the first page load, not on post back.
    3) DayRender event then fills the calendar with schedule information.

    4) Drop Down contains list of projects with AutoPostBack=TRUE.  When the user selects a new project, the SelectedIndexChanged event fires and it reloads the DataTable with updated information on the newly selected project.

    5) DayRend then fires again and the calendar information is updated.

    Problem now is that the DayRender event only populates information for the month that is currently visible in the calendar.  When the user selects the next or previous month, I get an error from the DayRender event that the DataTable does not exist.  Does this mean I need to rebuild the DataTable each time the user changes the month?  Can I save the original DataTable in view state?
    LVL 23

    Accepted Solution

    You will have to load the Data for your calendar on post back. You can save the DataTable in Session and load it from there on post back.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Join & Write a Comment

    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now