0

我想在加载母版页内容后加载内容页。我尝试过类似这样的 default.aspx

  <script type="text/javascript">
    function ShowProgress() {
        setTimeout(function () {
            var modal = $('<div />');
            modal.addClass("modal");
            $('body').append(modal);
            var loading = $(".loading");
            loading.show();
            var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
            var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
            loading.css({ top: top, left: left });
        }, 200);
    }
    $('form').submit("submit", function () {
        ShowProgress();
    });
 </script>
 <asp:Button ID="btnSubmit" runat="server" Text="Load Customers"
OnClick="btnSubmit_Click"  /<div class="loading" align="center">
Loading. Please wait.<br />
<br />
<img src="image/loading.gif" width="50" alt="" />
  </div>

这是 default.aspx.cs 代码

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        string script = "$(document).ready(function () { $('[id*=btnSubmit]').click(); });";
        ClientScript.RegisterStartupScript(this.GetType(), "load", script, true);
    }
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
    System.Threading.Thread.Sleep(5000);
    Repeater1.DataSource = GetKioskData(1);
    Repeater1.DataBind();
}
4

0 回答 0