2015-09-01 38 views
0

我需要顯示加載圖像,直到從數據庫中獲取數據並綁定到數據網格。我在父頁面(A.aspx)中有一個按鈕,當我們單擊該按鈕時,它將顯示Overlay中的數據( B.aspx)。我們使用greybox在疊加層中顯示頁面。我已經將加載圖像放入B.bpx頁面中。在頁面加載中處理數據網格中的數據獲取和顯示。由於所有的邏輯都是在page_load中處理的,所以這些元素在DOM中將不可用。如何在asp.net 4中的page_load事件之前顯示加載圖片?

我無法顯示/隱藏加載圖像。

注意:我試圖在父頁面(A.aspx)放置相同的加載圖像。但加載圖像顯示在疊加層後面。

請找到一段代碼:

在b.aspx.so使用b.aspx.onbeforeunload javascript函數是IE
protected void Page_Load(object sender, EventArgs e) 
    { 
     try 
     { 
      throbberSplashOverlay.Visible = true; 
     } 
} 





#ctl00_CPSContentHolder_throbberSplashOverlay 
{ 
    background-color:White; 
    position: fixed; 
    width: 100%; 
    height: 100%; 
    top: 0; 
    left: 0; 
    z-index: 500; 
} 
#throbberSplash 
{ 
    position: fixed; 
    left: 0px; 
    top: 0px; 
    width: 100%; 
    height: 100%; 
    z-index: 1000; 
    background: url(../App_Themes/Blue/images/indicator.gif) no-repeat center center; 
} 



<div id="throbberSplashOverlay" runat="server" visible="false"><div id="throbberSplash"></div></div> 
+0

什麼是#ctl00_CPSContentHolder_throbberSplashOverlay? –

+0

您是否重定向到其他頁面以顯示數據? – shreesha

+0

@Ursus:throbberSplashOverlay.ClientID –

回答

-1

按我的理解正在顯示的數據。
編輯:雖然頁面加載第一次,你不能調用JavaScript函數,直到頁面加載完成.so顯示一個等待圖像裏面div.and隱藏你的整個頁面,直到頁面加載完全。第二次,你可以使用onunload或onbeforeunload事件。

<html> 
<head> 
<script> 
</script> 

</head> 
<body onunload="doHourglass();" onbeforeunload="doHourglass();" onload="show();"> 
<div id="divWait" style="display:inline" > 
     <h1>wait...</h1> 
    </div> 

<div id="main" style="display:none"> 
<input type="button" onClick="call your method" /> 
//your rest of the html 
<div/> 

<script> 
function doHourglass() 
{ 
console.log("inside dohour glass"); 
var divwait=document.getElementById('divWait'); 
var divmainpage=document.getElementById('main'); 
divmainpage.style.zIndex="0"; 
divwait.style.zIndex="1"; 
divwait.style.display='inline'; 
divmainpage.style.display='none'; 
} 

function show() 
{ 
console.log("inside show"); 
var divwait=document.getElementById('divWait'); 
var divmainpage=document.getElementById('main'); 
divmainpage.style.zIndex="1"; 
divwait.style.zIndex="0"; 
divwait.style.display='none'; 
divmainpage.style.display='inline'; 
} 

</script> 
</body> 
</html> 
+0

這一個不工作。 –

+0

你正在打開b.aspx爲模態或新窗口 – shreesha

+0

作爲Modal使用Greybox –

相關問題