Monday, August 16, 2010

Ajax second postback not working in Sharepoint in UpdatePanel

Scenario

I had an update panel within the Sharepoint where the trigger is set to PostBackTrigger. Any button within the update panel triggered the click event only the first time. After that the click event never got fired until the whole page is refreshed.

This scenario was working in our test environment but doesn't work in our client's test environment. The difference is somewhere with the sharepoint setup.

Solution

Windows SharePoint Services JavaScript has a "form onSubmit wrapper" which is used to override the default form action. This work is put in place to ensure that certain types of URLs, which may contain double byte characters, will fully work across most postback and asynchronous callback scenarios. However, if your scenarios do not involve double byte character URLs, you may successful disable this workaround and gain the ability to use ASP.NET AJAX UpdatePanels.

To do this, you may need to register a client startup script which disables this workaround, in addition to resetting the default form action:

No comments:

Post a Comment