Copy codeThe Code is as follows:
<% @ Page Language = "C #" %>
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN"
Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
<Script runat = "server">
Void WaitFiveSeconds (object o, EventArgs e)
{
System. Threading. Thread. Sleep (5000 );
Label1.Text = DateTime. Now. ToLongTimeString ();
}
</Script>
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head id = "Head1" runat = "server">
<Title> ASP. net ajax </title>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Asp: ScriptManager ID = "ScriptManager1" runat = "server"/>
<Asp: UpdatePanel ID = "UpdatePanel1" runat = "server">
<ContentTemplate>
<Asp: Button ID = "Button1" runat = "server" Text = "Do something" OnClick = "WaitFiveSeconds"/> <br/>
<Asp: Label ID = "Label1" runat = "server"/>
</ContentTemplate>
</Asp: UpdatePanel>
<Asp: UpdateProgress ID = "UpdateProgress1" runat = "server" AssociatedUpdatePanelID = "UpdatePanel1">
<ProgressTemplate>
<Div style = "position: absolute; left: 200px; top: 150px; border: solid 1px black; padding: 4px;">
Loading, please stand...
</Div>
</ProgressTemplate>
</Asp: UpdateProgress>
</Form>
</Body>
</Html>