rivate void btnSubmit_ServerClick(object sender, System.EventArgs e)
  {
  Session["Name"] = txtName.Value;
  if( rbMale.Checked )
  Session["Sex"] = rbMale.Value;
  else
  Session["Sex"] = rbFemale.Value;
  Session["City"]
  lstCity.Items[lstCity.SelectedIndex].Text;
  Session["Address"] = txtAddress.Value;
  Session["Email"] = txtEmail.Value;
  Session["Intro"] = txtIntro.Value;
  // 把用户上载的图像文件保存起来
  // 然后把文件名保存在状态变量中
  HttpPostedFile pf = File1.PostedFile;
  string filename =
  System.IO.Path.GetDirectoryName(this.Request.PhysicalPath) +
  "\\" + System.IO.Path.GetFileName(pf.FileName);
  try
  {
  pf.SaveAs( filename );

  }

  catch

  {

  lblError.InnerText = "保存照片图像时出现错误!";

  }

  Session["Photo"] = filename;

  }

 / 定向到显示客户信息的页面

 rivate void btnDispInfo_ServerClick(object sender, System.EventArgs e)

  {

  this.Response.Redirect("dispinfo.aspx");

  }

 

 oid Page_Load( object sender, System.EventArgs e )

 

 / 如果不是第一次载入该页面,则
  // 向城市列表lstCity中添加项
  if( !this.IsPostBack )

  {
  lstCity.Items.Clear();
  lstCity.Items.Add(new ListItem("北京","北京"));
  lstCity.Items.Add(new ListItem("上海","上海"));
  lstCity.Items.Add(new ListItem("天津","天津"));
  lstCity.Items.Add(new ListItem("重庆","重庆"));
  lstCity.Items.Add(new ListItem("沈阳","沈阳"));
  lstCity.Items.Add(new ListItem("南京","南京"));
  lstCity.SelectedIndex = 0;
  }
  lblError.InnerText = "";

  }

 
 script language=javascript>

 unction CheckEmail()


 

 / 首先确定客户输入了EMAIL地址
 ar email = document.TestHtmlControl.txtEmail.value;
 f ( email.length == 0)
 
 lert("Email地址没有输入!");
 ocument.TestHtmlControl.txtEmail.focus();
 
 / 然后确定在EMAIL地址中包含"." 和"@"符号
 lse if(email.indexOf(".") == -1 || email.indexOf("@") == -1)
 
 lert("Email地址格式不对!\n” +
 正确格式应为[email]someone@china.com[/email])");
 ocument.TestHtmlControl.txtEmail.focus(); document.TestHtmlControl.txtEmail.select();
 
 
 /script>
 /把处理方法绑定到相应的控件上

 <INPUT id=txtEmail type=text name=Text2 runat="server"
 nblur="CheckEmail();">
 rivate void Page_Load(object sender, System.EventArgs e)
  {

  // 把客户信息放到表格中的控件中

  lblName.InnerText = (string)Session["Name"];
  lblSex.InnerText = (string)Session["Sex"];
  lblCity.InnerText = (string)Session["City"];
  lblAddress.InnerText = (string)Session["Address"];
  lblEmail.InnerText = (string)Session["Email"];
  txtIntro.Value = (string)Session["Intro"];
  imgPhoto.Src = (string)Session["Photo"];
  imgPhoto.Alt = "照片";

  }