zoukankan      html  css  js  c++  java
  • asp.net ajax 提交中,暂停提交


     from msdn
     protected void Button1_Click(object sender, EventArgs e)
            
    {
                System.Threading.Thread.Sleep(
    3000);
                Label1.Text 
    = System.DateTime.Now.ToString();
            }


    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        
    <title>Untitled Page</title>
    </head>
    <body>
        
    <form id="form1" runat="server">
        
    <div>
        
        
    </div>
        
    <asp:ScriptManager ID="ScriptManager1" runat="server">
        
        
    </asp:ScriptManager>
        
        
    <script type="text/javascript">
        
    var prm = Sys.WebForms.PageRequestManager.getInstance();
       prm.add_initializeRequest(InitializeRequest);
       
    function InitializeRequest(sender, args) {
        
    if (prm.get_isInAsyncPostBack())
          
    {
             args.set_cancel(
    true);
          }

       }

        
    function AbortPostBack() {
          
    if (prm.get_isInAsyncPostBack()) {
               prm.abortPostBack();
          }
            
        }

        
    </script>

        
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            
    <ContentTemplate>
                
    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
                
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            
    </ContentTemplate>
        
    </asp:UpdatePanel>
        
    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
            
    <ProgressTemplate>
                正在加载数据!
    <br />
                
    <input type="button" value="stop" onclick="AbortPostBack()" />

            
    </ProgressTemplate>
        
    </asp:UpdateProgress>
        
    </form>
    </body>
    </html>
  • 相关阅读:
    centos 7安装libreoffice
    python3-xlwt-Excel设置(字体大小、颜色、对齐方式、换行、合并单元格、边框、背景、下划线、斜体、加粗)
    PHP导出身份证号科学计数法
    PHP接收json格式的POST数据
    微信小程序知识
    搭建Vue开发环境的步骤
    公众号认证?小程序认证?小程序复用公众号资质进行认证?
    七牛云——批量将本地图片上传到七牛云
    身份认证接口
    php二维数组去重
  • 原文地址:https://www.cnblogs.com/gwazy/p/1015080.html
Copyright © 2011-2022 走看看