Thursday, August 20, 2009

Using ASP.NET AJAX Update Panel with Sitecore

A question came up during class last week about using the ASP.NET AJAX controls, particularly the UpdatePanel to improve the responsiveness of a Web page when doing the Poll Sublayout. This is a perfect example of when you would want a partial page update, rather than a full postback, when moving through a series of poll questions.

I did a little testing after class and found, as some of you did previously, that the UpdatePanel control did not seem to be working as expected in the Sitecore environment. I mentioned this to my esteemed colleague Seth Luersen and he knew immediately where to find the solution.

He directed me to this post on the SDN Forums:
http://sdn.sitecore.net/forum/ShowPost.aspx?PostID=5563

Although this post is a couple of years old it does address the issue.

I checked for the correct <httphandlers> in web.config:

<httphandlers>

<add path="ScriptResource.axd" verb="GET">

type="System.Web.Handlers.ScriptResourceHandler" validate="false"/>
</httphandlers>



That seems to be in place by default in Sitecore 6. However, a later reply mentioned the IgnoreUrlPrefixes setting.

<setting name="IgnoreUrlPrefixes
value="/trace.axd/sitecore/shell/Editor/sitecore/admin/upgrade/UnhandledException.aspx/
webresource.axd/ScriptResource.axd"/>


Adding ScriptResource.axd to this setting seems to be the key enabling the expected AJAX partial page update behavior.

So, thanks again to Seth for pointing this out. Let me know if this works out for you. It’s great to see how easy it is to add AJAX functionality to Sitecore.

1 comment:

  1. This is a very helpful post! It's important for people to know that AJAX works great with Sitecore.

    ReplyDelete