【发布时间】:2017-01-20 21:06:54
【问题描述】:
在我的 Web 应用程序中,我有一个包含加载栏的模式弹出窗口。我让它出现在任何我知道需要几秒钟才能执行的命令上,点击按钮等。
这目前运行良好,除了一个复杂的问题,它运行的内部网络服务器非常糟糕,并且根据用户数量可能会减慢导航到页面等简单任务的速度。
如何在每次页面考虑做某事时显示加载模式,而不必针对每个可能的场景进行硬编码?
我的 Web 应用程序正在使用包含模式代码的母版页。
谢谢
脚本
function ShowLoading() {
$('#modalLoading').modal({ backdrop: 'static', keyboard: false, show: true });
}
function HideLoading() {
$('#modalLoading').modal('hide');
}
ASPX
<div id="modalLoading" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-body">
<h2>
Please Wait...</h2>
<div class="progress">
<div class="progress-bar progress-bar-striped active" role="progressbar" style="width: 100%">
</div>
</div>
</div>
</div>
</div>
</div>
C# 类
public void loadingAlert()
{
var page = HttpContext.Current.CurrentHandler as Page;
page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "$(function () { ShowLoading(); });", true);
}
【问题讨论】:
标签: javascript c# jquery asp.net twitter-bootstrap