To regularly refresh the page, use the timer control. <asp: timer interval = "5000" runat = "server"/>
You need to configure the trigger for the time control. If the trigger event is triggered, the updatepanel will refresh the page. The attributes to be configured for the trigger include controlid and eventname. The following is an example.
<% @ 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">
Protected void page_load (Object sender, eventargs e ){
Currenttime. 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: scriptmanager>
<Asp: timer id = "fiveseconds" interval = "5000" runat = "server"/>
<Asp: updatepanel id = "updatepanel1" runat = "server">
<Contenttemplate>
<Asp: Label id = "currenttime" runat = "server"/>
</Contenttemplate>
<Triggers>
<Asp: asyncpostbacktrigger controlid = "fiveseconds" eventname = "tick"/>
</Triggers>
</ASP: updatepanel>
</Form>
</Body>
</Html>