title: How can I save an ASP.NET IFRAME from a custom entity's OnSave event, reliably?
body: <p>I have a custom ASP.NET solution deployed to the ISV directory of an MS Dynamics CRM 4.0 application.  We have created a custom entity, whose data entry requires more dynamism than is possible through the form builder within CRM.  To accomplish this, we have created an ASP.NET form surfaced through an IFRAME on the entity's main form.</p>
  
  <p>Here is how the saving functionality is currently laid out:</p>
  
  <ol>
  <li>There is an ASP.NET button control on the page that saves the entity when clicked.  This button is hidden by CSS.</li>
  <li>The button click event is triggered from the CRM OnSave javascript event.</li>
  <li>The event fires and the entity is saved.</li>
  </ol>
  
  <p>Here are the issues:</p>
  
  <ol>
  <li>When the app pool is recycled, the first save (or few) may:
  
  <ol>
  <li>not save</li>
  <li>be delayed (ie. the interface doesn't show an update, until the page has been refreshed after a few sec)</li>
  </ol></li>
  <li>Save and Close/New may not save</li>
  </ol>
  
  <p>For issue 1.1 and 2, what seems to be happening is that while the save event is fired for the custom ASP.NET page, the browser has moved on/refreshed the page, invalidating the request to the server.  This results in the save not actually completing.</p>
  
  <p>Right now, this is mitigated with a kludge javascript delay loop for a few seconds after calling the button save event, inside the entity OnSave event.</p>
  
  <p>Is there any way to have the OnSave event wait for a callback from the IFRAME?</p>