views:

681

answers:

6

I have a simple page with my ScriptManager and my UpdatePanel, and my ContentTemplate has one ListBox and one Label. I am just trying to catch its OnSelectionChanged so I can update the text in the Label. No matter what settings I try to tweak, I always get a full-page postback.

Is this really not going to work, or am I just screwing this up?

thanks, Chris

+2  A: 

You need to have Sharepoint 2007 service pack 1 -- or else there's no chance. (Sharepoint 2007 predates ajax 1.0 -- they built some support into service pack 1)

Next, from a trouble shooting point of view, test that the exact same code functions as expected when hosted in a regular asp.net page. (Literally copy and paste your code across into a fresh page, to rule out any typographical errors). Ruling sharepoint in or out of the problem area will help narrow down the solution space.

Leon Bambrick
A: 

There's a specific problem with mixing doPostback, UpdatePanel and SharePoint -- and the symptom is exactly what you're seeing: a full-page postback instead of an asynchronous postback. See this KB article for a workaround: http://support.microsoft.com/kb/941955

Matt Bishop
A: 

Todd Bleeker at Mindsharp showed me a piece of code he wrote that can use Ajax on Sharepoint 2.0. It was pretty cool. I believe the company used it on their sharepoint site managment software if you want to take a look. (you used to be able to request a 30 day trial). I bet how to do it is on their yahoo group (I can't remember the name, but I am sure that if you search for mindsharp you'll find it.)

As a note, Ajax has been around for a long time. Microsoft easily supported it since 2002 maybe earlier with the release of IE 5.5 (I don't know about other browsers, I was doing internal development and we only supported ie at the time). It just wasn't called that. The term Ajax is nothing more than a marketing term that someone coined later on.

Kevin
A: 

Getting the latest service pack for SharePoint 2007 will resolve your problem (and add full support for AJAX). Without the service pack you will need to follow an example like that outlined in this article:

AjaxBasePart: Easy ASP.NET 2.0 AJAX Extensions 1.0 and Office SharePoint Server 2007

Posting this hear so that people know there is an answer even without the latest service pack (secretGeek's response seems to say there is no chance).

spoon16
+2  A: 

If you have installed SharePoint 2007 (without Service Pack 1) then you can follow an example like the following article:

AjaxBasePart: Easy ASP.NET 2.0 AJAX Extensions 1.0 and Office SharePoint Server 2007

The reason for this is that there exists a specific problem with mixing doPostback, UpdatePanel and SharePoint -- and the symptom is exactly what you're seeing: a full-page postback instead of an asynchronous postback. See this KB article for a workaround: A Web Part that contains an ASP.NET AJAX 1.0 UpdatePanel control that uses the _doPostBack() ...

Otherwise you can just install Service Pack 1 to fix your problem:

Windows SharePoint Services 3.0 Service Pack 1 (SP1)

A: 

From a technology standpoint, Service Pack 1 does not add full support for ASP.NET AJAX. You still need use the workarounds described in the various articles mentioned in the previous answers.

Particulary, you need to make sure that the web.config file for your SharePoint Web application has been updated to support the appropriate version of the ASP.NET AJAX Extentions.

The fact that the web.config had not been updated was the mostly likely cause of the problem described in the original question.

Rob Windsor