Using ASP.Net AJAX With SharePoint / MOSS 2007

Search

Accessible SharePoint WebSites
Download ARF

Using ASP.Net AJAX With SharePoint / MOSS 2007

http://blog.thekid.me.uk

I have just started to use the ASP.Net AJAX UpdatePanel within SharePoint. There is a bit of configuration of web.config, but getting it to work isn’t that bad.

Once it is all configured and and working there are two problems you will encounter.

The first is to do with one of the standard SharePoint controls using Response.Write(), which affects the AJAX response. Thanks to ‘disturbed’ and this thread which explains that the ‘welcome.ascx’ uses Response.Write(). To solve this problem you will need to remove ‘welcome.ascx’ from the master page of any page which uses AJAX.

The second is that you can only get the first AJAX call to work, all subsequent call fail. This appears to be a problem in the SharePoint JavaScript. After a bit of script debugging I managed to find the culprit in ‘init.js’ in the form of a variable called _spFormOnSubmit. In this script file SharePoint checks to see if there has already been a postback on the page and if it has it won’t do another one.

The code looks like this…

function _spFormOnSubmitWrapper()

{

    if (_spSuppressFormOnSubmitWrapper)

    {

        return true;

    }

    if (_spFormOnSubmitCalled)

    {

        return false;

    }

 

….

 

Commenting out the return false allows the function to continue and ultimately to submit the request to SharePoint.

 

Modifying SharePoint script files directly probably isn’t the best idea and I am not sure of the consequences, but it does allow you to continue development until a better solution is found.

Posted by Vincent Rothwell on Friday, 19 Jan 2007 21:40  - 2 Comments
Orininally printed from http://thekid.me.uk - Copyright Vincent Rothwell 2007
 

Comments

Sunday, 27 Jul 2008 10:36 by Emmie
I ran into this problem, you might find some help in this: http://baigadil.blogspot.com/2008/06/ajaxifying-wss-30-moss-2007-webconfig.html

Sunday, 27 Jul 2008 10:36 by Denny
Hi Vince, Check this out http://dennyonline.wordpress.com/2007/08/14/sharepoint-and-ajax/



Url

Email

Comments