編輯:主要問題似乎是,我只是做一箇舊的網站項目「添加現有項目」到一個ASP.NET Web應用程序項目。這導致了我從頭開始非常麻煩,除了不添加現有項目,我添加了新的母版頁和aspx頁到項目然後填充他們。同樣的問題仍然存在。「System.Web.UI.MasterPage不包含定義...」ASP.NET錯誤
我有一個傳統項目,只是一個標準的網站。我已經開始一個新的項目作爲一個Web應用程序,並已移植到我需要的所有頁面中。不過,我收到100+的錯誤,是由以下的大多是略有不同的排列組合:
'System.Web.UI.MasterPage does not contain a definition for 'headerImage'
(我得到這個代碼隱藏)'MasterPage' does not contain a definition for 'imgHeader'
(也這是後臺代碼)
關於第一個錯誤,就好像項目並不理解主頁設置。我設置的母版頁在我的aspx頁面每一個的頂部,如:
<%@ page language="C#" masterpagefile="~/MasterPages/MasterPage.master" autoeventwireup="true" inherits="Equipment.aspx.cs" title="Untitled Page" %>
<%@ MasterType VirtualPath="~/MasterPages/MasterPage.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<!-- some content -->
</asp:Content>
另外,我明明在〜/ MasterPages/MasterPage.master代碼隱藏揭露headerImage
屬性:
public partial class MasterPage : System.Web.UI.MasterPage
{
#region Properties
private string _headerImage;
public string headerImage
{
get
{
return _headerImage;
}
set
{
_headerImage = (string)value;
}
}
// other stuff
}
但是VS仍然在System.Web.UI.MasterPage基類中尋找這個屬性!
我已經簽出this後,它並沒有解決我的問題。
想法?所有的反饋意見。多謝你們。
這裏是該文件的內容「〜/ MasterPages/MasterPage.master – MethodMan 2012-02-14 14:17:01
@DJKRAZE我是VS ASP.NET的新手,如果你的意思是擴展名,它只是.master和.cs代碼後面的 – kmarks2 2012-02-14 14:20:40