DayPilot Knowledge Base

AJAX Calendar/Scheduling Controls
DayPilot Pro (AJAX Calendar Control)
» DayPilot ASP.NET Calendar
DayPilot Pro (AJAX Monthly Calendar Control)
» DayPilot ASP.NET Monthly Calendar
DayPilot Pro (AJAX Scheduler Control)
» DayPilot ASP.NET Scheduler
DayPilot » Knowledge Base » How to force the modal dialog to load its content from the server (instead of the cached version)

How to force the modal dialog to load its content from the server (instead of the cached version)

Last revision: Jun 11, 2012

event calendar modal dialog

If the modal dialog shows outdated calendar event data (especially in IE) it might be necessary to force a reload from the server.

There are two ways to do it:

1. Disable caching in the modal dialog page

Add the following code to page that handles the modal dialog content (usually Edit.aspx):

private void Page_Load(object sender, System.EventArgs e)
{
  // ...
  Response.Cache.SetNoServerCaching();
  Response.Cache.SetNoStore();
  // ...
}

2. Add a random string to the modal dialog page URL

Modify the dialog source URL by adding a random dummy parameter:

  function eventClick(e) {
    var modal = dialog();
    modal.showUrl("Edit.aspx?id=" + e.value() + "&dummy=" + new Date().getTime());
  }

  function dialog() {
    var modal = new DayPilot.Modal();
    modal.top = 60;
    modal.width = 300;
    modal.opacity = 70;
    modal.border = "10px solid #d0d0d0";
    modal.closed = function() { 
      if(this.result == "OK") { 
        dps1.commandCallBack('refresh'); 
      }
      dps1.clearSelection();
    };
	
    modal.height = 250;
    modal.zIndex = 100;
    return modal;
  }

Related

How to show event details in a modal dialog (modal.js)
How to open an event edit dialog from a context menu (Calendar)
How to make the modal dialog draggable
How to open a new event dialog using TimeRangeSelected event (modal.js)