~刚才关于类的写法问题已经解决,,谢谢大家了。
只是后面又提了个问题似乎没人看到,没办法,,只好另外开贴了。。
第一页代码:
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default2.aspx");
    }
    public RegistrationInformation RegistrationInformation
    {
        get
        { 
            RegistrationInformation host=new RegistrationInformation();
            host.Name = TextBox1.Text;
            if (RadioButton1.Checked == true)
                host.Sex = "男";
            else
                host.Sex = "女";
            host.Nation = DropDownList1.SelectedValue;
            return host;
        }
    }
}
第二页代码:
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RegistrationInformation host = PreviousPage.RegistrationInformation;
        Label1.Text = host.Name;
        Label2.Text = host.Sex;
        Label3.Text = host.Nation;
    }
}
//======================================================
错误
“System.Web.UI.Page”并不包含“RegistrationInformation”的定义 //=========================================================问题应该出在第一页的那个按纽。。因为那里没有调入类,所以导致第二页找不到这个类吧。。
类在第一页作为PUBLIC~如何调用进去呢?

解决方案 »

  1.   

    怎么感觉你在做winform程序
    跟第一页没关系,网页中传数据不是这么传的哦
      

  2.   

    _Default objDefault1 = new _Default();
    通过对象来访问
      

  3.   

    shaohaiou() 
    怎么感觉你在做winform程序
    跟第一页没关系,网页中传数据不是这么传的哦//=============================================呵呵,我是尝试调用类的方法把值赋过去,,熟悉类的使用
    ----------------------------------------------------
    gui0605(千分散尽还复来)
    _Default objDefault1 = new _Default();
    通过对象来访问
    //===========================================================
    第二个窗口的Page_Load里面吗?
      

  4.   

    try:
    public partial class _Default : System.Web.UI.Page 
    {
        protected void Page_Load(object sender, EventArgs e)
        {    }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Server.Transfer("Default2.aspx");
        }
        public string name 
        {
    get
    {
    return TextBox1.Text;
    }
        }
         public string sex 
        {
    get
    {
    return RadioButton1.Checked ?  "男" : "女";
    }
        }
        public string nation
        {
    get
    {
    return DropDownList1.SelectedValue;
    }
        }
    }
    第二页代码:
    public partial class Default2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
    _Default default = (_Default)Context.Handler ;
            Label1.Text = default.name;
            Label2.Text = default.sex;
            Label3.Text = default.nation;
        }
    }
      

  5.   

    sbqcel(活死人 ━═☆ 吊死在一棵树上的猪!) //-------------------------------------------------------呵呵,谢谢,,这个传值的方法我知道的,,我想了解下,如何把类的值传过去呢?还是学了一招
    public string sex 
        {
    get
    {
    return RadioButton1.Checked ?  "男" : "女";
    }
        }:)~
      

  6.   

    shaohaiou() 
    把类放session里传
    //===========================================
    那还不如直接就用Seesion传嘛。。就是想了解下类的传值方法。。
      

  7.   

    http为无状态的,在Redirect后,重新开始了一个生命周期
      

  8.   

    http://community.csdn.net/Expert/topic/5317/5317071.xml?temp=.5507929
      

  9.   

    sbqcel(活死人 ━═☆ 吊死在一棵树上的猪!) 谢谢。可以结贴了。。去那贴看看。。呵呵~