<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="Default"%>
<!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>Register Async Controls</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div id="pageContent">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<h2>
<asp:Label runat="server" ID="Label1" Text="[write here]" />
</h2>
</ContentTemplate>
</asp:UpdatePanel>
<h2>
<asp:Label runat="server" ID="Label2" Text="[write here::no update panel]" />
</h2>
<asp:Button runat="server" ID="Button1" Text="Refresh" OnClick="Button1_Click" />
</div>
</form>
</body>
</html>
File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ScriptManager1.RegisterAsyncPostBackControl(Button1);
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Last update at: " + DateTime.Now.ToLongTimeString();
Label2.Text = "Last update at: " + DateTime.Now.ToLongTimeString();
}
}
|