更新进度控制在 asp.net 中不起作用
本文关键字:net 不起作用 asp 控制 更新 | 更新日期: 2023-09-27 17:56:29
我定义了一个<asp:UpdateProgress>
的<asp:UpdatePanel>
<asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="update1" runat="server">
<ContentTemplate>
<asp:Label id="lblresult" runat="server"></asp:Label><br /><br />
<asp:Button ID="btn1" runat="server" Text="Refresh" OnClick="btn1_Click" /> <br />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="up1" runat="server" AssociatedUpdatePanelID="update1">
<ProgressTemplate>
<span style="color:green; font-style:italic;">Loading, please wait...</span>
</ProgressTemplate>
</asp:UpdateProgress>
按钮事件定义为
protected void btn1_Click(object sender, EventArgs e)
{
lblresult.Text = "<span style='color:red;'>"+ DateTime.Now.ToString() +"</span>";
}
但是,我没有得到Loading, please wait...
<script type="text/javascript">
var updateProgress = null;
function postbackButtonClick() {
updateProgress = $find("<%= uprMaster.ClientID %>");
window.setTimeout("updateProgress.set_visible(true)", updateProgress.get_displayAfter());
return true;
}
</script>
<asp:Button runat="server" Text="Search" ID="btnSearch" OnClick="btnSearch_Click" ClientIDMode="Static" OnClientClick="return postbackButtonClick();" />
将更新进度放在里面喜欢这个
<asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="update1" runat="server">
<ContentTemplate>
<asp:UpdateProgress ID="up1" runat="server" AssociatedUpdatePanelID="update1">
<ProgressTemplate>
<span style="color:green; font-style:italic;">Loading, please wait...</span>
</ProgressTemplate>
<asp:Label id="lblresult" runat="server"></asp:Label><br /><br />
<asp:Button ID="btn1" runat="server" Text="Refresh" OnClick="btn1_Click" /> <br />
</ContentTemplate>
</asp:UpdatePanel>
</asp:UpdateProgress>