2011-02-16 9 views
0

나는 견과류를 몰고있는 문제가 있습니다.C# 형식 또는 네임 스페이스 이름을 찾을 수 없습니다.

부모가 Server.Transfer() 함수를 사용하는 2 개의 ASPX 페이지가 있습니다. 아이가 Submit.aspx.cs에서 Review.aspx

이라고 반면 부모가 Submit.aspx라고, 내가 가진 :

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 

public partial class Contacts_Submit : BasePage 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 

    } 
    protected void Review_Click(object sender, EventArgs e) 
    { 
     Server.Transfer("Review.aspx", true); 
    } 

    /* 
    * Sequence of functions that will server as a Get functionality that will 
    * return the text inside each textbox. 
    * These information will be used by "Review.aspx" to validate the 
    * information given by the user before final submission takes place. 
    */ 
    public string GetFirstName { get { return FirstName.Text; } } 
    public string GetLastName { get { return LastName.Text; } } 
    public string GetAddress { get { return Address.Text; } } 
    public string GetCountry { get { return Country.SelectedValue; } } 
    public string GetProvince { get { return Province.SelectedValue; } } 
    public string GetCity { get { return City.Text; } } 
    public string GetZipCode { get { return ZipCode.Text; } } 
    public string GetWorkPhone { get { return WorkPhone.Text; } } 
    public string GetMobilePhone { get { return MobilePhone.Text; } } 
    public string GetFax { get { return Fax.Text; } } 
    public string GetEmail { get { return Email.Text; } } 
    public string GetCompany { get { return Company.Text; } } 
    public string GetWebsite { get { return Website.Text; } } 
    public string GetRelationship { get { return Relationship.SelectedValue; } } 
} 

가 Review.aspx.cs에 반면, 내가 가진 :

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Data; 
using System.Configuration; 
using System.Collections; 
using System.Web.Security; 
using System.Web.UI.WebControls.WebParts; 
using System.Web.UI.HtmlControls; 

public partial class Contacts_Review : BasePage 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 
     if(PreviousPage != null) 
     { 
      Contacts_Submit prevpage = PreviousPage as Contacts_Submit; 
      //FirstName.Text = PreviousPage.GetFirstName; 
     } 
    } 
} 

"Contacts_Submit prevpage = PreviousPage as Contacts_Submit"을 선언 할 때 문제가 발생합니다. 시스템에서 "유형 또는 네임 스페이스 이름 'Contacts_Submit'을 찾을 수 없습니다 (사용 지시문이나 어셈블리 참조가 누락 되었습니까?)"라는 오류가 표시됩니다.

저는 ASP.NET과 C# 둘 다 초보자입니다. 아무도 도와 줄 수 없나요? 고마워요.

답변

4

은 그래서 캐스트가 유효하지 않은, 당신은 단지

Contacts_Submit prevpage = PreviousPage as Contacts_Submit; 

대신

Contacts_Submit prevpage = PreviousPage as System.Data.DataSet Contacts_Submit; 
0

Contacts_Submit이 아닌 데이터 세트에 관련된 어떤 식 으로든 페이지의 유형과 이다 싶은 생각합니다. 제거하면 괜찮을 것입니다.

+0

죄송합니다. 코드를 업데이트하지 않으십시오. 사실 저는 System.Data와 함께 두 가지 방법을 모두 사용했습니다. 하지만 여전히 작동하지 않습니다. 이것은 정말로 혼란 스럽다. – Sammm

관련 문제