AJAX and Publishing Pages

Last year I was working on a project and was required to use AJAX on a Web Part to display some things on a site.  No problem I thought.  Then, I had to enable this on a publishing site…problems begin.  Tried finding anything and everything regarding this problem and found that several people had the same issue.  I posted on forums, ran it past MS, co-workers, etc, no dice.  Today I was playing with a couple of other things and found the solution.  The issue is in the order of which the master pages display.  To make AJAX web parts work from a publishing site master page, you have to do the following:

1. Turn on AJAX for thw web.config (I follow Jan T’s solution for integrating AJAX the lazy way)

2. Create a web part page (ASP.Net AJAX project with 3.5) and use the UpdatePanel and the ScriptManager
        – There are several ways to do this without adding the ScriptManager to the .master page. 

3.  Make sure to add the EnsurePanelFix JavaScript thing…you can find that about anywhere on the net

4.  The most important thing, you have to make sure the master page is set up properly!!!!!!!!
         – For example, the default.master in SharePoint, works fine, however, blueband.master (and all the other ones in publishing “MasterPages”) have some flaws
                     – <Title>:  This is on separate lines, move this all together:
                    – SPWebPartManager: This needs to be Inside the <form> tag

If you use the default.master page that is in the publishing master pages, it works FINE...so the chance that they were close and the issue was in the master page was high.  I sure hope this helps someone else.

Walkthrough: Creating a Basic ASP.Net AJAX-enabled Web Part
Good reference, even though this is for the old toolkit. About everything here can be applied to the current stuff


One thought on “AJAX and Publishing Pages

  1. Thank you for this — this is pure gold.

Comments are closed.