我已經創建了一個名爲MyMasterPage的母版頁。ASP.NET - 你如何引用一個不在app_code中的類
public partial class MyMasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
我也創建了一個名爲Class 1類中的app_code:
public class Class1
{
public Class1()
{
MyMasterPage m;
}
}
在Class我想引用MyMasterPage但我得到一個編譯器警告:
The type or namespace name 'MyMasterPage' could not be found (are you missing a using directive or an assembly reference?)
做些什麼碼我需要添加才能使這個工作?
類在文件夾如下:
alt text http://www.yart.com.au/stackoverflow/masterclass.png
到底在哪你的母版類關係到你的App_Code文件? – 2009-04-16 01:32:17
您的代碼可以訪問App_Code文件夾中的Class1嗎? – TechTravelThink 2009-04-16 01:39:33