zoukankan      html  css  js  c++  java
  • Ajax second postback not working in Sharepoint in UpdatePanel

    We have one problem in work, we spend with that two days without any solution, all we found cause some another problem. This is what help us when the page is not making second postback in update panel when the first postback is fired by element in UpdatePanel and refresh only update panels on the page.

    Taken from Mike Ammerlaan’s Blog

    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.

    To do this, you may need to register a client startup script which disables this workaround, in addition to resetting the default form action:

    1. <script type='text/javascript'>  
    2.   _spOriginalFormAction = document.forms[0].action;  
    3.   _spSuppressFormOnSubmitWrapper=true;  
    4. </script>  

    This script may be directly embedded in the page, or could be emitted by a control that uses the UpdatePanel. The following is an example of a very simple method which will fix this issue:

    1. private void EnsureUpdatePanelFixups()  
    2. {  
    3.   if (this.Page.Form != null)  
    4.   {<br />  
    5.     string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];  
    6.     if (formOnSubmitAtt == "return _spFormOnSubmitWrapper();")  
    7.     {  
    8.       this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";  
    9.     }  
    10.   }  
    11.   ScriptManager.RegisterStartupScript(thistypeof(AjaxUpdatePanelPart), "UpdatePanelFixup""_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;"true);  
    12. }  
  • 相关阅读:
    HDU- 1075 What Are You Talking About (Trie or map)
    HDU-1251 统计难题 (Trie)
    Trie树模板(插入和查询)
    HDU 5120 Intersection
    HDU 5025 Saving Tang Monk(状压bfs)
    Light OJ 1094 (树的直径)
    zzuli 1877 蛤玮打扫教室
    HDU 5642 King's Order(数位dp)
    POJ 2689 Prime Distance
    hdu 3853 LOOPS(概率dp)
  • 原文地址:https://www.cnblogs.com/Areas/p/2267235.html
Copyright © 2011-2022 走看看