This is a migrated thread and some comments may be shown as answers.

RadAjax stops working in SharePoint when using diffrerent skin

2 Answers 78 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Marcel
Top achievements
Rank 1
Marcel asked on 22 Aug 2008, 07:28 PM
I have developed a web app using radajaxpanels and have it running successfully outside of sharepoint.

In sharepoint the ajax mostly stops working and instead performs a postback.

On the few occasions where the ajax is still working such as when i click a grid row into edit mode, the page becomes unresponsive. A page refresh returns it back to the original state.

I have checked my web.config. What else am i missing? The app works fine outside of SharePoint.
thanks
Marcel

2 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 25 Aug 2008, 08:22 AM
Hello Macrel,

Please add the following script on PreRender of your page and verify if this will fix the problem:

private void EnsureUpdatePanelFixups()
{
if (this.Page.Form != null)
{
string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
if (formOnSubmitAtt == "return _spFormOnSubmitWrapper();"
{
this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
}
}

ScriptManager.RegisterStartupScript(Page, typeof(AjaxUpdatePanelPart), "UpdatePanelFixup", "_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;", true);
}

All the best,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Marcel
Top achievements
Rank 1
answered on 11 Sep 2008, 04:42 PM
After some more hunting, I found David Frost's post radajaxmanager sharepoint 2007 bug - telerik Forum. I repeat his answer here with some minor clarifications that worked for me. Thank you David!

[Solved]:  The error was in the SharePoint 2007 integration.  Many of the articles on the web utilize this function called EnsureUpdatePanelFixups().  Which is written primarily for WebPart development.  My application is built with *.aspx pages, which are added to SharePoint 2007 using the "Upload Document" feature.  Below is the code that I had to comment out to get the AjaxManager (or in my case RadAjaxPanel) working (note: uncommenting the lines below will work for WebParts but not aspx pages).

In the HTML:

<script type="text/javascript">

_spOriginalFormAction = document.forms[0].action;

_spSuppressFormOnSubmitWrapper=

true;

</script>

In the Code Behind:

protected void Page_PreRender(object sender, EventArgs e)

{

    EnsureUpdatePanelFixups();

}

private void EnsureUpdatePanelFixups()

{

//if (this.Page.Form != null)

//{

// string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];

// if (formOnSubmitAtt == "return _spFormOnSubmitWrapper();")

// {

// this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";

// }

//}

RadScriptManager.RegisterStartupScript(this, GetType(), "UpdatePanelFixup", "_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;", true);

}

Tags
Ajax
Asked by
Marcel
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Marcel
Top achievements
Rank 1
Share this question
or