2017-08-04 96 views
0

我有asp.net頁面的母版頁。當我更新內容頁面整個母版頁面刷新爲此,我使用ajax腳本管理器來更新僅內容頁面。 現在我想用裝載機母版頁和page.but我的裝載機內容是不行的proper.when我更新的內容頁面加載不work.below是我的內容頁如何在asp.net中使用加載器與主頁面和內容頁面?

<asp:ScriptManager ID="ScriptManager1" runat="server"/> 
      <asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
       <ContentTemplate> 

        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> 
        </asp:ContentPlaceHolder> 
       </ContentTemplate> 
      </asp:UpdatePanel> 

代碼和我的加載程序代碼低於我在我的內容頁面使用

<script type="text/javascript"> 
    $(window).load(function() { 

     $("form1").li(500); 
    }); 
</script> 

刷新整個頁面加載程序的工作,但對於內容頁面加載程序不工作。

回答

0

enter image description here

Page = Sys.WebForms.PageRequestManager.getInstance(); 
Page.add_beginRequest(OnBeginRequest); 
Page.add_endRequest(endRequest); 


function OnBeginRequest(sender, args) { 
    blockUI(); 
} 
function endRequest(sender, args) { 
    unblockUI(); 
} 

嘿,你需要使用這種方法從每一個網頁。

+0

我在哪裏可以使用這一個 –

+0

您需要使用內容的地方這個腳本持有人在每個asp.net主網頁 –

+0

現在檢查更新的圖像 –

0

爲此,您需要在母版頁中添加加載器和腳本。

首先,添加圖像與一些JS彈出屬性

<div id="statusPopup" style="display: none; z-index: 1000; left: 49%; top: 49%;"> 
     <div>    
      <img src="../Images/sprites.gif" alt="Loading......" /> 
     </div> 
    </div> 

,並添加母版頁下面給出腳本

<!-- Note : Always keep this script at the bottom of page | To show loading/processing logo --> 

    <script type="text/javascript"> 
     if (Sys != null) { 
      Sys.Application.add_load(AppLoad); 
     } 

     function AppLoad() { 
      Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest); 
      Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest); 

      function beginRequest(sender, args) { 
       // show the popup 


       document.getElementById("statusPopup").style.position = "fixed"; 
       document.getElementById("statusPopup").style.display = ""; 

      } 

      function endRequest(sender, args) { 
       document.getElementById("statusPopup").style.display = "none"; 
       seconds = 60 * 18; 
      } 
     } 

</script> 
相關問題