我有一个带有 ToolkitScriptManager 的页面和三个更新面板,每个更新面板都有基于控件的触发器,现在我的问题是触发任何服务器端事件,显示进度条如百分比示例,如何在 PostBackTriggers 和 AsyncPostBackTriggers 控件中显示,我的代码是
<asp:UpdatePanel ID="up1" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TxtZip" EventName="textchanged" />
</Triggers>
<ContentTemplate>
<asp:TextBox ID="TxtZip" runat="server" AutoPostBack="true" ClientIDMode="Static"
MaxLength="6" onkeypress="return isNumberKey(event)" CssClass="txtstyle" OnTextChanged="TxtZip_TextChanged"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:PostBackTrigger ControlID="IBtnSave" />
</Triggers>
<ContentTemplate>
<span class="art-button-wrapper"><span class="l"></span><span class="r"></span>
<asp:Button ID="IBtnSave" runat="server" Text="Submit/Save" CssClass="art-button"
ClientIDMode="Static" OnClientClick="return postbackButtonClick()" OnClick="IBtnSave_Click" />
</span>
</ContentTemplate>
</asp:UpdatePanel>
我的进度条码
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DynamicLayout="true">
<ProgressTemplate>
<div id="Progressbar" class="Progressbar" align="center" valign="middle" runat="server">
<asp:Image ID="Image1" Width="75" Height="95" runat="server" ImageUrl="~/images/animation_processing.gif" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
和java脚本代码是
<script type="text/javascript">
//update panel and postback trigger with fileupload control upadteprogressbar code
var updateProgress = null;
function postbackButtonClick() {
updateProgress = $find("<%= UpdateProgress1.ClientID %>");
window.setTimeout("updateProgress.set_visible(true)", updateProgress.get_displayAfter());
return true;
}
</script>
此代码仅在 postbacktrigger 中起作用,原因是在触发 onclick 事件之前单击按钮,该事件调用 java 脚本函数,但 Async Postback 触发器不调用该函数,如何处理该代码并以百分比过程显示进度条,给我任何建议