八蛋

Ajax

   <form id="form1" runat="server">
    <div>
        <asp:Button ID="btnEdit" runat="server" Text="更 改" onclick="btnEdit_Click" />
   
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
       
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Label ID="lblText" runat="server" Text="单击上面按钮"
                    ondatabinding="lblText_DataBinding"></asp:Label>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnEdit" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
        <ProgressTemplate>
            Loading...
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:Timer ID="Timer1" runat="server" Interval="2000" OnTick="Timer1_Tick">
    </asp:Timer>
    </form>


   protected void btnEdit_Click(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(200);
            this.lblText.Text =System.DateTime.Now.ToString();
        }

        protected void lblText_DataBinding(object sender, EventArgs e)
        {

        }

        protected void Timer1_Tick(object sender, EventArgs e)
        {
            lblText.Text = DateTime.Now.ToString();
        }
    }

posted on 2009-08-12 22:31  八蛋  阅读(99)  评论(0编辑  收藏  举报

导航