Force Calendar Control to "Re-Bind"

Posted on 2006-04-19
Medium Priority
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
  • 2
LVL 23

Expert Comment

ID: 16489400
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

ID: 16491326
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

naveenkohli earned 2000 total points
ID: 16491621
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

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

807 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