none
传递参数的问题 RRS feed

  • 问题

  • using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    
    namespace WebApplication9_1
    {
      public partial class _Default : System.Web.UI.Page
      {
        public string FullInformation
        {
          get
          {
            return ((TextBox)this.ZhuCe1.FindControl("TextBox1")).Text;
          }
        }
        public string CH
        {
          get
          {
            return ((RadioButton)this.ZhuCe1.FindControl("RadioButton1")).Checked ? "先生 " : " 女士";
          }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
          this.ZhuCe1.TargetLocationPage = "~/Page2.aspx";
          this.ZhuCe1.Quit = "";
             }
      }
    }
    
    这个是default.aspx.cs的代码
    
    <pre>using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    
    namespace WebApplication9_1
    {
      public partial class Page2 : System.Web.UI.Page
      {
        protected void Page_Load(object sender, EventArgs e)
        {
          if (Page.PreviousPage != null)
          {
            string str;
            int hour = System.DateTime.Now.Hour;
            if (hour > 0 && hour <= 6)
            { str = "凌晨好!"; }
            else if (hour > 6 && hour <= 9)
            { str = "早上好!"; }
            else if (hour > 9 && hour <= 12)
            { str = "上午好!"; }
            else if (hour > 12 && hour <= 14)
            { str = "中午好!"; }
            else if (hour > 14 && hour <= 17)
            { str = "下午好!"; }
            else if (hour > 17 && hour <= 22)
            { str = "晚上好!"; }
            else
            { str = "午夜好!"; }
            _Default _default = PreviousPage as _Default;
            Response.Write(str + "欢迎 <b>" + _default.FullInformation + "</b> " + _default.CH + " 注册账号");
          }
        }
      }
    }
    
    
    这个是Page2的代码
    我的主要问题是Page2中                Response.Write(str + "欢迎 <b>" + (String)Session["fullinfor"] + "</b> " + (String)Session["xingbie"] + " 注册账号");<br/>的代码没有执行
    
    恳请高人指教
    
    2011年5月19日 4:37

答案

全部回复