<script language="c#" runat="server">
public void button_click(Object sender,EventArgs e)
{
show.Text=name.Text;
name.Text="";
}
</script>
<html>
<head>
<title>textbox test page</title>
</head>
<body>
<form runat="server">
<table>
<tr>
<td>User Name:</td>
<td><asp:textbox id="name" columns="20" AutoPostBack="true" onTextChanged="button_click" runat="server"/></td>
</tr>
<tr>
<td>Show Message:</td>
<td><asp:textbox id="show" textmode="multiline" columns="40" rows="10" readonly="true" runat="server"/></td>
</tr>
</table>
</form>
</body>
</html>
运行上面的范例,在第一个文本框中输入内容,把焦点移开就会出发button_click()事件。