<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/Style/NiuLan.css" rel="stylesheet" type="text/css" />
<title></title>
<script type="text/javascript">//當(dāng)刷新的時(shí)候 原先的頁(yè)面的展示數(shù)據(jù)不會(huì)隱藏這里面是隱藏函數(shù)
//取得PageRequestManager對(duì)象,每一個(gè)Asp.net Ajax頁(yè)面中會(huì)右唯一一個(gè)這種對(duì)象負(fù)責(zé)處理所有的Async - Postback要求
var prm = Sys.WebForms.PageRequestManager.getInstance(); //新增事件處理至PageRequestManager的initializeRequest事件,當(dāng)Async-Postback發(fā)生時(shí),此事件會(huì)被觸發(fā),我們的InitRequest函數(shù)便會(huì)被運(yùn)行
prm.add_initializeRequest(InitRequest);
//新增事件處理至PageRequestManager的endRequest事件,當(dāng)Async-Postback完成時(shí),此事件會(huì)被觸發(fā),我們的EndRequest函數(shù)便會(huì)被運(yùn)行
prm.add_endRequest(EndRequest); function InitRequest(sender, args) {
//顯示出UpdateProgress1控件
document.getElementById('detail').style.display = "none";
}
function EndRequest(sender, args) {
//隱藏UpdateProgress1控件
document.getElementById('detail').style.display = "block";
}
//用于取消Async-Postback動(dòng)作
function CancelClick() {
//當(dāng)處于Async-Postback動(dòng)作時(shí),get_isInAsyncPostBack函數(shù)會(huì)回傳true,此時(shí)調(diào)用abortPostBack 函數(shù)便會(huì)取消Async-Postback動(dòng)作。
if (prm.get_isInAsyncPostBack()) {
prm.abortPostBack();
}
}
</script>
</head>
<body >
<form id="Form1" runat="server">
//使用 Ajax Extensitons 中的ScriptManager
<asp:ScriptManager runat="server">
</asp:ScriptManager>
//使用地方比如
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
//放代碼
<div id="detail"><asp:ImageButton ID="ibtnFBSJ" runat="server" ImageUrl="/images/ershoufang/bs/fbsj.gif"
OnClick="ibtnFBSJ_Click" />
</div>
//當(dāng)在靜態(tài)刷新頁(yè)面的時(shí)候會(huì)調(diào)用UpdateProgress 但是這個(gè)后臺(tái)也是需要代碼的看下面
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<div style="text-align: center">
<img alt="" src="https://www.gxlcms.com/images/loading.gif" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
后臺(tái)
protected void ibtnFBSJ_Click(object sender, ImageClickEventArgs e)
{
System.Threading.Thread.Sleep(2000);
drpSortOrder.SelectedValue = ((int)ErShouFangJiChuZuFang.order.按發(fā)布時(shí)間排序).ToString();
PopulateDetails();
}
//這樣就可以實(shí)現(xiàn)為靜態(tài)刷新頁(yè)面,帶加載過(guò)程中有旋轉(zhuǎn)圖片,用戶體驗(yàn)會(huì)很好效果如下
當(dāng)然你也可以使用jquery或者ajax寫動(dòng)態(tài)加載table的方式來(lái)實(shí)現(xiàn)聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com