日期:2014-05-17 浏览次数:20524 次
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test2013-01-09.aspx.cs" Inherits="_2012.Forms.test2013_01_09" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label runat="server" ID="lbl1"></asp:Label>
<asp:Button runat="server" ID="btn1" OnClick="btnClick" Text="测试按钮" />
<script runat="server" type="text/C#">
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
lbl1.Text = DateTime.Now.ToString("g");
}
protected void btnClick(object o, EventArgs e)
{
Response.Write(string.Format("控件{0}回发读取到的文本:{1}",(o is Button)?((Button)o).ID:"Null", lbl1.Text));
}
</script>
</div>
</form>
</body>
</html>