Telerik RadGrid not using AJAX in SharePoint Application Page

I have a SharePoint application page (A page that resides in _layouts and inherits from Microsoft.SharePoint.WebControls.LayoutsPageBase) Where I have a Telerik RadGrid. I have Ajaxified the grid by using a Telerik RadAjaxManager however whenever I filter or page the grid it performs a full page postback rather than an ajax callback. 

I managed to get this working by following the instructions here:
http://www.telerik.com/community/forums/aspnet/ajax/radajaxmanager-sharepoint-2007-bug.aspx#605189

It appears it is the UpdatePanel functionality of AJAX that doesn’t play out of the box with WSS:

Windows SharePoint Services JavaScript has a “form onSubmit wrapper” which is used to override the default form action. This work is put in place to ensure that certain types of URLs, which may contain double byte characters, will fully work across most postback and asynchronous callback scenarios. However, if your scenarios do not involve double byte character URLs, you may successful disable this workaround and gain the ability to use ASP.NET AJAX UpdatePanels.

 taken from http://blogs.msdn.com/sharepoint/archive/2007/03/02/integrating-asp-net-ajax-with-sharepoint.aspx

So the code I have added to my SharePoint Application Page is:

protected override void CreateChildControls()
{
      base.CreateChildControls();
      this.EnsureUpdatePanelFixups();
}

private void EnsureUpdatePanelFixups()
{
     ScriptManager.RegisterStartupScript(this, typeof(XXXXYourApplicationPageClassXXXXX), “UpdatePanelFixup”, “_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;”, true);
}

Note: This works for Application Pages only. If you are building a WebPart and having the same issue then the fix for this is mentioned in the links below.

Other useful resources:
http://www.telerik.com/community/forums/aspnet-ajax/ajax/ajax-controls-in-sharepoint-application-page-causing-postbacks.aspx
http://sharepoint.microsoft.com/blogs/mike/Lists/Posts/Post.aspx?ID=3
http://www.marten-online.com/sharepoint/ajax-second-postback-not-working-in-sharepoint-in-updatepanel.html

Advertisements

3 Responses to Telerik RadGrid not using AJAX in SharePoint Application Page

  1. aki says:

    How did you get done these?

    I have a SharePoint application page (A page that resides in _layouts and inherits from Microsoft.SharePoint.WebControls.LayoutsPageBase) Where I have a Telerik RadGrid.

    I’m just starting SharePoint and don’t know how to use RadControls in Application Pages… Kindly Please let me know….

    Thank you so much..

    • tidwtf says:

      Sorry for the very late reply aki, This blog has been dormant for a while now and I’ve only just logged in. I did this some time ago and have moved onto other technologies so have forgotten the details. I hope you find (have found) a solution.

  2. asp.net, c#,javascript…

    […]Telerik RadGrid not using AJAX in SharePoint Application Page « things I don’t want to forget[…]…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: