Showing posts with label Ajax. Show all posts
Showing posts with label Ajax. Show all posts

Friday, April 13, 2007

Enabling Ajax in MOSS 2007

Ajax greatly enhance any web application by reducing postback of ASP.NET pages. This instantly gives better user experience with the Ajax-enabled web application. Best of all, implementing it is fairly straight forward. That is, if SharePoint 2007 is not in the picture.

If you're building a ajax web application that sits on top of MOSS 2007, there's a couple of things you need to set:

If your custom app uses any of the SharePoint master page (such as default.master), ensure the wss user control Welcome is removed:

<wssuc:welcome id="IdWelcome" runat="server" enableviewstate="false"></wssuc:Welcome> This affects Ajax postbacks. Removing it will partially fix the problem. One-time ajax postback works, subsequently, it will fail. Secondly, the other change required is at LAYOUTS\1033\init.js file 1. Look for javascript function _spFormOnSubmitWrapper. 2. Under “if (_spFormOnSubmitCalled)” code block, remove/comment the “return false;” code. I'm not sure whether making this change would affect SharePoint, but so far seems ok. Do use this at your own risk though. Hopefully there's a fix for this in SharePoint soon so that Ajax will work without this kind of hack.

Reference made to Vincent Rothwell's blog: http://blog.thekid.me.uk/2007/01/19/using-aspnet-ajax-with-sharepoint-moss-2007-2/