页面提交后,服务端控件的值为什么没有改变
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %>
<script runat="server">
void Page_Load(object sender, System.EventArgs e) {
string strTestText = "hjt"; //注释掉这两句后就值就可以
testText.Value = strTestText;//改变
}
void textChange(object sender, System.EventArgs e) {
testText2.Value = testText.Value;
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<form runat="server">
<input type="text" id="testText" runat="server" />
<input type="text" id="testText2" runat="server" />
<input type="submit" id="submit" runat="server" OnServerClick = "textChange" />
</form>
</body>
</html>
当更改testText里的内容以后,我用visaul stdio调试时,发现testText.Value的值根本没有随之改变,这是为什么呢?我想在数据库中调一篇文章显示出来,然后更改后放回数据库,但testText的值却不随我更改而变化,还是开始时赋的值。