AJAX UpdatePanel and SharePoint

Hello Guys,

A Days before i had added ajax update panel in my usercontrol,the usercontrol is render in webpart with sharepoint application.but i can't see the affect of update panel on my sharepoint site,and i got frushtrated.finally i was going for some R&D and got solution.

Basically, the workaround is adding an additional function to your code page that alters the _spFormOnSubmitWrapper and the _spFormOnSumitWrapper So, You need to add following line of code in your Page_Load event and it works for you.

[C# Example]
if (this.Page.Form != null)
{
string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
if (formOnSubmitAtt == “return _spFormOnSubmitWrapper);”)
{
this.Page.Form.Attributes["onsubmit"] = “_spFormOnSubmitWrapper();”;
}
}

ScriptManager.RegisterStartupScript(this, typeof(CompanyRegistration),“UpdatePanelFixup”,“_spOriginalFormAction=document.forms].action;_spSuppressFormOnSubmitWrapper=true;”,true);

That's it...Problem Solved,Hope it works for you.

No comments: