I'm accessing Masterpage properties from a regular ASP.NET C# page by doing the following:
((SecondMasterPage)(Page.Master)).speciallink = true;
((SecondMasterPage)(Page.Master)).specialspan = false;
That works fine in a page's code-behind, but when I try to move it to a function in my base class file like this:
public class MyBaseClass : System.Web.UI.Page
{
public void portalFuncs()
{
((SecondMasterPage)(Page.Master)).speciallink = true;
((SecondMasterPage)(Page.Master)).specialspan = false;
}
}
... I get the following error message:
Compiler Error Message: CS0246: The type or namespace name 'SecondMasterPage' could not be found (are you missing a using directive or an assembly reference?)
My base class file is in my App_Code directory and other functions in there work without errors. Why won't this function work? Also if a function like this particular one won't work in my base class file, where could I put it so it would be available to be called from any page?