DayPilot Forums

DayPilot is the best open-source Outlook-like calendar control for ASP.NET.
DayPilot Pro Demo (Calendar control)
» DayPilot Pro live demo (Calendar control)
DayPilot Pro Demo (Scheduler control)
» DayPilot Pro live demo (Scheduler control)
Home » Bugs » Ajax updatepanel with multiview

Ajax updatepanel with multiview

Hi Dan,

I am not sure that this is a bug or not. While I was testing the new month-view I encountered the following 'bug'. To reproduce it, follow the following steps:
  1. Create new page
  2. Add ScriptManager and UpdatePanel
  3. Add Multiview with 2 views (View1 and View2)
  4. Add 2 buttons
  5. In View1; place a DayPilotCalendar
  6. In View2: place a DayPilotMonth
  7. Add actions to the buttons: MultiView1.SetActiveView(View1) and MultiView1.SetActiveView(View2)
  8. Run website & view the javascript errors saying it doesn't know the DayPilot objects
It is probably a bad thinking of me as the object is not sent to the client at all when the page is first loaded (no view is set). After a postback by ajax it (the javascript) will try to overwrite the object which should be on te page. That is not the case because it was not rendered before (no view was set).

Ofcourse this can be solved in different ways.
Jan Marten - 12/13/2007 12:14:38 PM
Hi Jan,

Thanks for reporting it. The problem seems to be in the initialization JavaScript.

The JavaScript code is split into two parts:
  1. General stuff that doesn't change with PostBacks (the libraries, the DayPilot client-side objects creating, etc.)
  2. Code that changes after PostBack (values initialization).
The part #2 uses methods of ASP.NET AJAX Extensions to include the code in the page. That ensures it is properly executed after a partial PostBack.

But it still expects that part #1 was included properly which is not the case if it's on an invisible View.

I will need to play with the JavaScript including a little bit in order to fix this.

The following workaround can be used by that time: Put DayPilotCalendar and DayPilotMonth into TabPanels (inside a TabContainer) from Ajax Control Toolkit. The whole TabContainer can be inside an UpdatePanel. Since it loads all the TabPanels during the initial page load it includes all the necessary JavaScript as well.
Dan Letecky - 12/17/2007 4:50:10 PM
Post reply