设置控件是否是异步回发

aspx
     < form id = " form1 "  runat = " server " >
        
< asp:ScriptManager ID = " ScriptManager1 "  runat = " server " >
        
</ asp:ScriptManager >
        
        
< asp:UpdatePanel ID = " UpdatePanel1 "  runat = " server "  UpdateMode = " Conditional " >
            
< ContentTemplate >
                
<%=  DateTime.Now  %>
                
< asp:Button ID = " Button2 "  runat = " server "  Text = " Button "   />
            
</ ContentTemplate >
        
</ asp:UpdatePanel >
        
        
< asp:Button ID = " Button1 "  runat = " server "  Text = " Button "  OnClick = " Button1_Click "   />
    
</ form >

cs
     protected   void  Page_Load( object  sender, EventArgs e)
    {
        ScriptManager.GetCurrent(
this ).RegisterAsyncPostBackControl( this .Button1);
        ScriptManager.GetCurrent(
this ).RegisterPostBackControl( this .Button2);
    }

    
protected   void  Button1_Click( object  sender, EventArgs e)
    {
        
this .UpdatePanel1.Update();
    }

你可能感兴趣的:(异步)