日期:2014-05-19  浏览次数:20542 次

刚才一贴已结~再开贴问个简单问题~
~刚才关于类的写法问题已经解决,,谢谢大家了。
只是后面又提了个问题似乎没人看到,没办法,,只好另外开贴了。。
第一页代码:
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~如何调用进去呢?

------解决方案--------------------
怎么感觉你在做winform程序
跟第一页没关系,网页中传数据不是这么传的哦
------解决方案--------------------
_Default objDefault1 = new _Default();
通过对象来访问
------解决方案--------------------
把类放session里传
------解决方案--------------------
http://community.csdn.net/Expert/topic/5317/5317071.xml?temp=.5