你所说的不实。害得我还写了个程序给你测试了一下:<%@ 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 Button1_Click(object sender, EventArgs e)
{
this.Button1.Text = "测试结果:" + this.TextBox1.Text;
this.TextBox1.Enabled = false;
} protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
this.TextBox1.Text = "现在是"+ DateTime.Now.ToShortTimeString();
}
</script><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>
</form>
</body>
</html>
自己反思一下,问题出在哪里?
{
this.Button1.Text = "测试结果:" + this.TextBox1.Text;
this.TextBox1.Enabled = false;
} protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
this.TextBox1.Text = "现在是"+ DateTime.Now.ToShortTimeString();
}
</script><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>
</form>
</body>
</html>
自己反思一下,问题出在哪里?
asp.net2.0是这样的,具体原因和解决方法参见http://blog.csdn.net/net_lover/archive/2006/09/25/1282127.aspx
asp.net2.0之后就有这个问题了。