考虑一个带有关联代码文件(aspx.cs)的Web表单(aspx)。如何在ASP.NET Web窗体类中处理类字段?
在的CodeFile,例如,我们有以下几点:
public partial class MyPage : System.Web.UI.Page {
int myint;
string mystring;
public void Page_Load(object sender, EventArgs e) {
...
if (!this.IsPostBack) {
this.myint = 2;
this.mystring = "Hello";
}
...
}
}
我可以期望有两个变量每次页面回发?我的意思是:页面类字段保持为Web表单状态的一部分吗?
三江源
蒂姆·我想你是我成为.NET GURU!非常感谢你总是如此详细(以良好的方式)并且在你的答案中清楚。 :) – Andry