Web part updatepanel not working in publishing portal – ASP.NET AJAX and SharePoint


Today, I manage to solve this problem after spending hours of googling. During the integration between ASP.NET AJAX and SharePoint, you might found that AJAX does not working in certain type of SharePoint site template.

First, AJAX does not work in publishing site without doing some modification on the master page. It works in other site template such team site. The problem is that, the webpart manager TAG inside the master page“<WebPartPages:SPWebPartManager runat=”server”/>” has been placed before the Form Tag. To resolve this issue, just cut it and paste after the Form Tag as below

Original Code
<body class=”body” onload=”_spBodyOnLoadWrapper();”>
<WebPartPages:SPWebPartManager runat=”server”/>
<form runat=”server” onsubmit=”return _spFormOnSubmitWrapper();”>

….
….
Resolved Code
<body class=”body” onload=”javascript:if (typeof(_spBodyOnLoadWrapper) != ‘undefined’) _spBodyOnLoadWrapper();”>
<form runat=”server” onsubmit=”return _spFormOnSubmitWrapper();”>
<asp:ScriptManager runat=”server” ID=”ScriptManager1″></asp:ScriptManager>
<WebPartPages:SPWebPartManager runat=”server”/>

….
….

* You might found the similar solution in other place. I do a summary and make it easier to search by users with the correct keywords.

Google Chrome – Good for user but not developer?


Google launch its new Web Browser – Chrome today. Check out here: http://googleblog.blogspot.com/2008/09/fresh-take-on-browser.html

I just curious do we need another new browser beside MS Internet explorer and Mozilla FireFox? Personally, I think the current browsers already full-fill what I need. As a web developer, we need to build our web application to support these 2 major browsers. Now, Google launch another new browser, Chrome. Although, they complied w3c and other web standards, but it always got minor differences in UI rendering. This means that we need to put in extra efforts to support another new browser. I guess it should be good news to user but more efforts for us.

403 Forbidden when access SharePoint portal site


After we ran a content deployment job we seem to have this recurring issue where hitting the SharePoint site when one is unauthorized gives the generic 403 Forbidden message. So we found ourselves having to authenticate first (by visiting a backend list or manually going to the _layouts/authenticate.aspx page to bring up the popup to get the credentials…

We don’t know why the site would not ask me to log in to begin with; instead it goes right to the 403 error…
Solution

We added read access to the application pool user on the Inetpub directory to solve this issue. This may have been lost on content deployment or some other way. However it seems to have been the root of the issue all along.

* Thanks to Alexander who share out this issue.

Redirecting User on ItemAdding in SharePoint EventHanlders


Here is an issue from my colleague.

The problem

We got a custom list for which handling ItemAdding Event, in the ItemAdding Event (We are creating a site). We are trying to redirect user to a custom site page, the redirection works fine but the item doesn’t gets added to the list at the same time the site gets created.  On ItemAdded, we are trying the redirection code but HttpContext is null

The Solution

The reason why our item isn’t added is when its redirect, the current thread is aborted and the item is never added to the list. We will have to manually add the item.
HttpContext is null in the ItemAdded because this event is asynchronous – The HttpContext is only available within the constructor when a synchronous event is fired.

The following article explains the same problem and provides a details solution:
http://www.entwicklungsgedanken.de/2008/03/27/redirecting-from-newformaspx-to-dispformaspx-after-creating-a-new-item/

* Thanks to Elin and Akhilesh!