Ajax User Control in SharePoint

I have got a problem from one of my friend on using Ajax control on top of SharePoint and below is problem

Basically his user control consists of an update panel. The user control renders properly at the beginning & when I click on some button it posts back asynchronously and the things work as they should. The second time I click on any  button it does not posts back. He was also using a JavaScript control in the Page. In the web application “__doAsyncPostBack()function” works which is being called from “NodeClicked()function” but this function is not working on SharePoint site (It once/twice worked when I run through the debugger). So he made it working using “__doPostBack()function” in place of “__doAsyncPostBack()function”.


Solution for the above problem

By default sharePoint allow single post back for the AJAX update panel. This is because WSS emits submit wrapping javascript that tampers with how your page submits. It does this to ensure that urls that involve double byte (read unicode) characters post back appropriately. To get your  update panels working need  to remove this script. You can disable it by emitting the following javascript:

<script type=’text/javascript’>_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;</script>

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s