using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace ApplyViewState
{
	/// <summary>
	/// WebForm1 的摘要说明。
	/// </summary>
	public class WebForm1 : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Panel Panel0;
		protected System.Web.UI.WebControls.Panel Panel1;
		protected System.Web.UI.WebControls.DropDownList CardType;
		protected System.Web.UI.WebControls.Panel Panel2;
		protected System.Web.UI.WebControls.Label MyLabel;
		protected System.Web.UI.HtmlControls.HtmlInputButton Next1;
		protected System.Web.UI.HtmlControls.HtmlInputButton Pre1;
		protected System.Web.UI.HtmlControls.HtmlInputButton Next2;
		protected System.Web.UI.HtmlControls.HtmlInputButton Pre2;
		protected System.Web.UI.HtmlControls.HtmlInputButton Finish;
		protected System.Web.UI.WebControls.TextBox FirstName;
		protected System.Web.UI.WebControls.TextBox TxtAddress;
		protected System.Web.UI.WebControls.TextBox TxtCity;
		protected System.Web.UI.WebControls.TextBox TxtState;
		protected System.Web.UI.WebControls.TextBox TxtZip;
		protected System.Web.UI.WebControls.TextBox CardNum;
		protected System.Web.UI.WebControls.TextBox Expires;
		protected System.Web.UI.WebControls.TextBox LastName;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			if (!IsPostBack)
				ViewState["PanelIndex"] = 0;
		}

		void Next_Click(Object Src, EventArgs E ) 
		{
			String PrevPanelId = "Panel" + ViewState["PanelIndex"].ToString();
			ViewState["PanelIndex"] = (int)ViewState["PanelIndex"] + 1;
			String PanelId = "Panel" + ViewState["PanelIndex"].ToString();

			Panel p = (Panel)FindControl(PanelId);
			p.Visible=true;

			p = (Panel)FindControl(PrevPanelId);
			p.Visible=false;
		}

		void Prev_Click(Object Src, EventArgs E ) 
		{
			String PanelId = "Panel" + ViewState["PanelIndex"].ToString();
			ViewState["PanelIndex"] = (int)ViewState["PanelIndex"] - 1;
			String PrevPanelId = "Panel" + ViewState["PanelIndex"].ToString();

			Panel p = (Panel)FindControl(PanelId);
			p.Visible=false;
			p = (Panel)FindControl(PrevPanelId);
			p.Visible=true;
		}

		void Finish_Click(Object Src, EventArgs E ) 
		{

			String PanelId = "Panel" + ViewState["PanelIndex"].ToString();
			Panel p = (Panel)FindControl(PanelId);
			p.Visible=false;

			MyLabel.Text += "<b>您注册的信息如下所示：</b><p>";
			MyLabel.Text += "名字：" + FirstName.Text + "<br>";
			MyLabel.Text += "姓氏：" + LastName.Text + "<br>";
			MyLabel.Text += "地址：" + TxtAddress.Text + "<br>";
			MyLabel.Text += "城市：" + TxtCity.Text + "<br>";
			MyLabel.Text += "州：" + TxtState.Text + "<br>";
			MyLabel.Text += "邮政编码：" + TxtZip.Text + "<br>";
			MyLabel.Text += "卡号：" + CardNum.Text + "<br>";
			MyLabel.Text += "信用卡类型：" + CardType.SelectedItem.Text + "<br>";
			MyLabel.Text += "失效日期：" + Expires.Text + "<br>";
		}


		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN：该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.Next1.ServerClick += new System.EventHandler(this.Next_Click);
			this.Pre1.ServerClick += new System.EventHandler(this.Prev_Click);
			this.Next2.ServerClick += new System.EventHandler(this.Next_Click);
			this.Pre2.ServerClick += new System.EventHandler(this.Prev_Click);
			this.Finish.ServerClick += new System.EventHandler(this.Finish_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}
