2012-06-22 21 views
1

我一直在做這個小時,它不斷出現相同的錯誤。我不知道爲什麼!我設法爲masterpage創建了第一個webform。不知何故,後續webforms獲得相同的錯誤。使用母版頁創建網頁表格

這是我創造的Web窗體:

<%@ Page Title="" Language="C#" MasterPageFile="~/EIDShopMain.Master" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="mainWebsite_EID_Shop_.WebForm3" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> 
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> 
</asp:Content> 

,當我想在瀏覽器中查看:

Server Error in '/' Application. 
Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 
Parser Error Message: Could not load type 'mainWebsite_EID_Shop_.Global'. 
Source Error: 
Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="mainWebsite_EID_Shop_.Global" Language="C#" %> 

更新:這是一個ASP.Net Web應用程序項目。

WebForm3的代碼隱藏:

namespace mainWebsite_EID_Shop_ 
{ 
    public partial class WebForm3 : Page 
    { 
    } 
} 

任何人都可以解釋爲什麼某個網頁表格的作品和有時它不工作。

UPDATE2:多個錯誤:

Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 
Parser Error Message: Could not load type 'mainWebsite_EID_Shop_.EIDShopMain'. 
Source Error: 
Line 1: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="EIDShopMain.master.cs" Inherits="mainWebsite_EID_Shop_.EIDShopMain" %> 
Line 2: 
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">; 
+0

是它Web應用程序項目或Web站點項目? – abatishchev

+0

也請發佈您的代碼隱藏文件。 – abatishchev

+0

正如你所看到的,錯誤是在Global.asax中,而不是WebForm3.aspx – abatishchev

回答

0

你的Global.asax看起來應該像下面這樣:

<%@ Application Inherits="mainWebsite_EID_Shop_.Global" %> 

和Global.asax.cs中:

namespace mainWebsite_EID_Shop_ 
{ 
    public class Global 
    { 
    } 
} 
+0

P.S.使用下劃線結束命名空間名稱絕對是一個糟糕的設計。 – abatishchev

+0

並不反對你是一個糟糕的設計,但我似乎記得導致visual studio命名空間頁面的情況,就像web站點項目中默認的那樣(folder_folder)。它可能是當您將網站項目轉換爲Web應用程序項目時?或者就像在網站項目中默認的那樣?不要以爲我曾經選擇使用網站項目,否則我可以更明確地告訴你;)。 –

+0

@KennethIto:iirc,默認情況下是網站項目名爲_Default的代碼隱藏文件類。從未見過由下劃線結尾的自動生成的命名空間。我仍然可能是錯的。 – abatishchev