我正在为我的网页中的更新面板使用更新进度控件。我为 updateprogress 指定了一个条件,即只有当它获得相应的回发元素时才应该加载。只有当只有一个回发元素时它才能正常工作。如何检查页面中的其他回发元素并启用 updateprogress 控件。我的代码为
<style type="text/css">
.Background
{
position: fixed; left: 0; top: 0; z-index: 10; width: 100%;height: 100%;
filter: alpha(opacity=40);
}
</style>
<script type="text/JavaScript" language="JavaScript">
function pageLoad() {
var manager = Sys.WebForms.PageRequestManager.getInstance();
manager.add_endRequest(endRequest);
manager.add_beginRequest(OnBeginRequest);
}
function OnBeginRequest(sender, args) {
var postBackElement = args.get_postBackElement();
if (postBackElement.id == 'Button1') {
$get('UpdateProgress1').style.display = "block";
}
$get('ParentDiv').className = 'Background';
}
function endRequest(sender, args) {
$get('ParentDiv').className = '';
} </script>
我的 aspx 代码为
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<div id="ParentDiv">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<td height="403">
<iframe id="IFOEvent" name="InIframe" scrolling="auto" runat="server"
width="75%" height="203" class=""></iframe>
</td>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" />
</Triggers>
</asp:UpdatePanel>
</div>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<div id="IMGDIV" align="center">
<img src="Images/loading.gif" alt="" /><br />
</div>
</ProgressTemplate>
</asp:UpdateProgress>