private void Page_Load(object sender, System.EventArgs e)
{
if (!this.IsPostBack)
{
obj = new localhost.Service1();
Session["obj"] = obj;
}
}
#region Web Form 設計工具產生的程式碼
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 此為 ASP.NET Web Form 設計工具所需的呼叫。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 此為設計工具支援所必須的方法 - 請勿使用程式碼編輯器修改
/// 這個方法的內容。
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
localhost.Service1 obj;
private void Button1_Click(object sender, System.EventArgs e)
{
obj = (localhost.Service1)Session["obj"];
Button1.Text = obj.GetNo().ToString();
}