How can I save an ASP.NET IFRAME from a custom entity's OnSave event, reliably?
Posted
by Forgotten Semicolon
on Stack Overflow
See other posts from Stack Overflow
or by Forgotten Semicolon
Published on 2010-04-10T18:23:02Z
Indexed on
2010/04/10
18:53 UTC
Read the original article
Hit count: 237
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.
Here is how the saving functionality is currently laid out:
- There is an ASP.NET button control on the page that saves the entity when clicked. This button is hidden by CSS.
- The button click event is triggered from the CRM OnSave javascript event.
- The event fires and the entity is saved.
Here are the issues:
- When the app pool is recycled, the first save (or few) may:
- not save
- be delayed (ie. the interface doesn't show an update, until the page has been refreshed after a few sec)
- Save and Close/New may not save
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.
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.
Is there any way to have the OnSave event wait for a callback from the IFRAME?
© Stack Overflow or respective owner