Friday, May 15, 2009

How to fix up Update Panel to work in Sharepoint

How to Make UpdatePanel to work in Sharepoint

In sharepoint, the Ajax update panel will not work properly.

for this we have to add a fixup code in c#.

cal this function in the On_Init event in the Update Panel page. This fixup will work in Ajax enabled Sharepoin

t Site.(in aspx).

the code is as follows


public static void EnsureUpdatePanelFixups(System.Web.UI.Page webPage,Type pageType)
{
if (webPage.Form != null)
{
String fixupScript = @"_spBodyOnLoadFunctionNames.push(""_initFormActionAjax"");
function _initFormActionAjax()
{
if (_spEscapedFormAction == document.forms[0].action)
{
document.forms[0]._initialAction = document.forms[0].action;
}
}
var RestoreToOriginalFormActionCore = RestoreToOriginalFormAction;
RestoreToOriginalFormAction = function()
{
if (_spOriginalFormAction != null)
{
RestoreToOriginalFormActionCore();
document.forms[0]._initialAction = document.forms[0].action;
}
}
";
System.Web.UI.ScriptManager.RegisterStartupScript(webPage, pageType, "UpdatePanelFixup", fixupScript, true);
}
}

cal this function in On_Init event and this fixup will make the updatepanel to work fine.
by

கண்ணன்.ம.க

No comments:

Post a Comment

HTML/JAVASCRIPT BLOG

You can find the help for html and javascript codes

Any Doubts Contact my Mail-ID:
kannan.mkv@gmail.com