ASP.NET and AJAX: Error Making Forms Visible With UpdatePanel
While converting a site to a MasterPage-driven site, I ran across an issue involving UpdatePanels, Panels and Forms. The scenario is that in my MasterPage, I have an UpdatePanel that wraps my ContentPlaceHolder, thereby applying the AJAX functionality to all pages associated with that MasterPage. The content page in question has a panel that is invisible until a button is pressed. The contents of the panel are two non-server forms for PayPal and Google Checkout. Before I converted the site to MasterPages and AJAX, the functionality performed correctly, but afterwards, the site would hang (ie, not complete the server side action), and the browser would produce the Javascript error:
“Unknown runtime error”
I tried many different combinations of contents for the panel, but the only one that seemed to produce the error was whenever a form was present inside the panel. This was very frustrating, as no one around the internet community really seemed to have run across this error, and modifying the MasterPage to account for this single scenario would be a nightmare.
A working solution I came up with for this rare error is to wrap your content (on your .aspx page) with another UpdatePanel and set your triggers to post back when the button is pressed. While the client may have to suffer another postback, it’s not as bad as a total loss of functionality.
If you can find a more elegant solution to this problem, I would love to hear it!
EDIT (2/29/08): I believe the error occurs whenever you are using nested HTML forms within your runat=”server”. If you’re looking to post to another form, please see my article on integrating PayPal and Google Checkout.
RSS Feed