search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Ajax updatepanel with multiview

Asked by Jan Marten
17 years ago.
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.
Comment posted by Dan Letecky
17 years ago.
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.
Comment posted by Anonymous
15 years ago.

Is this still an issue?

Comment posted by John REYNIER
14 years ago.

Hi,

it seems to still be a problem.

Here are the steps i followed :

Add an update panel

Inside updatepanel, add tab container

trigger the updatepanel refresh

code behind :

dynamically add tabcontrols. Each tabcontrol contains a dynamically added daypilot calendar

When trying to render the page, javascript error occurs : "DayPilotCalendar" is not defined.

I hope there's a way to workaround this problem.

Comment posted by John REYNIER
14 years ago.

As a workaround, i add to my page a daypilot calendar, which remains hidden.

This way, all needed javascript is present, and the error is gone. It's not a really nice solution, but i provides a way to make it work while this bug is not fixed.

Comment posted by Anonymous
13 years ago.

Hi,

I am using a DayPilotCalendar control on a user control, there is also a AJAX tab container, where I have three tabs, DayPilotCalendar is on all three tabs. But for one time is working only for onr tab only. Not on all three tabs as I change the tab. (e.g. if iI comment the first one then works for second and if I comment for second then it works for third one).
Please suggest If anybody has any idea.

Regards

Vivek Sharma

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.