Bug in VS2005? ,or just not sure how to do this!

Discussion in 'ASP .Net' started by Paul, Feb 19, 2008.

  1. Paul

    Paul Guest

    I have a file called clBasePage.cs in the appCode directory (using vs 2005)
    and I have a master page in the root website directory called
    Masterpage.master.cs.
    In the masterpage file I have
    public partial class QSISMasterPage : System.Web.UI.MasterPage
    {
    }
    so it inherits System.Web.UI.MasterPage.

    The problem is that in the file clBasePage.cs I can not access the
    QSISMasterPage class as I tried

    public class clsBasePage : System.Web.UI.Page
    {
    private QSISMasterPage master; // trying to declare a private variable of
    type
    }
    QSISMasterPage but I get the error
    type or namespace QSISMasterPage could not be found.

    Any Suggestions? thanks.
    --
    Paul G
    Software engineer.
     
    Paul, Feb 19, 2008
    #1
    1. Advertising

  2. Paul-

    What's the namespace of the QSISMasterPage? Sometimes, on web projects,
    it's easy to get the namespaces confused if you move files in and out of
    directories. I'd suggest double checking that and be sure it's what you
    intended it to be (and that your addressing it correctly in your base page).

    For example:

    namespace SandBoxWeb
    {
    public partial class TestMasterPage: MasterPage
    { }
    }

    Would be addressed in a code behind as:

    SandBoxWeb.TestMasterPage (or just TestMasterPage if within the same parent
    scope).

    Or...

    namespace SandBoxWeb.test
    {
    public partial class ClientScriptBlock : MasterPage
    { }
    }

    Would be addressed in a code behind as:

    SandBoxWeb.test.TestMasterPage (or just test.TestMasterPage if within the
    same parent scope).

    Hope this helps!

    -dl

    --
    David R. Longnecker
    http://blog.tiredstudent.com

    > I have a file called clBasePage.cs in the appCode directory (using vs
    > 2005)
    > and I have a master page in the root website directory called
    > Masterpage.master.cs.
    > In the masterpage file I have
    > public partial class QSISMasterPage : System.Web.UI.MasterPage
    > {
    > }
    > so it inherits System.Web.UI.MasterPage.
    > The problem is that in the file clBasePage.cs I can not access the
    > QSISMasterPage class as I tried
    >
    > public class clsBasePage : System.Web.UI.Page
    > {
    > private QSISMasterPage master; // trying to declare a private variable
    > of
    > type
    > }
    > QSISMasterPage but I get the error
    > type or namespace QSISMasterPage could not be found.
    > Any Suggestions? thanks.
    >
     
    David R. Longnecker, Feb 19, 2008
    #2
    1. Advertising

  3. Paul

    Elmo Watson Guest

    In my estimation, you should never directly access a page of any kind in a
    class.

    What exactly are you needing to do with the Master Page?

    David Wier
    http://aspnet101.com
    http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
    bloated markup


    "Paul" <> wrote in message
    news:...
    >I have a file called clBasePage.cs in the appCode directory (using vs 2005)
    > and I have a master page in the root website directory called
    > Masterpage.master.cs.
    > In the masterpage file I have
    > public partial class QSISMasterPage : System.Web.UI.MasterPage
    > {
    > }
    > so it inherits System.Web.UI.MasterPage.
    >
    > The problem is that in the file clBasePage.cs I can not access the
    > QSISMasterPage class as I tried
    >
    > public class clsBasePage : System.Web.UI.Page
    > {
    > private QSISMasterPage master; // trying to declare a private variable of
    > type
    > }
    > QSISMasterPage but I get the error
    > type or namespace QSISMasterPage could not be found.
    >
    > Any Suggestions? thanks.
    > --
    > Paul G
    > Software engineer.
     
    Elmo Watson, Feb 19, 2008
    #3
  4. Paul

    Paul Guest

    thanks for the information, will double check the namespace tomorrow.
    --
    Paul G
    Software engineer.


    "David R. Longnecker" wrote:

    > Paul-
    >
    > What's the namespace of the QSISMasterPage? Sometimes, on web projects,
    > it's easy to get the namespaces confused if you move files in and out of
    > directories. I'd suggest double checking that and be sure it's what you
    > intended it to be (and that your addressing it correctly in your base page).
    >
    > For example:
    >
    > namespace SandBoxWeb
    > {
    > public partial class TestMasterPage: MasterPage
    > { }
    > }
    >
    > Would be addressed in a code behind as:
    >
    > SandBoxWeb.TestMasterPage (or just TestMasterPage if within the same parent
    > scope).
    >
    > Or...
    >
    > namespace SandBoxWeb.test
    > {
    > public partial class ClientScriptBlock : MasterPage
    > { }
    > }
    >
    > Would be addressed in a code behind as:
    >
    > SandBoxWeb.test.TestMasterPage (or just test.TestMasterPage if within the
    > same parent scope).
    >
    > Hope this helps!
    >
    > -dl
    >
    > --
    > David R. Longnecker
    > http://blog.tiredstudent.com
    >
    > > I have a file called clBasePage.cs in the appCode directory (using vs
    > > 2005)
    > > and I have a master page in the root website directory called
    > > Masterpage.master.cs.
    > > In the masterpage file I have
    > > public partial class QSISMasterPage : System.Web.UI.MasterPage
    > > {
    > > }
    > > so it inherits System.Web.UI.MasterPage.
    > > The problem is that in the file clBasePage.cs I can not access the
    > > QSISMasterPage class as I tried
    > >
    > > public class clsBasePage : System.Web.UI.Page
    > > {
    > > private QSISMasterPage master; // trying to declare a private variable
    > > of
    > > type
    > > }
    > > QSISMasterPage but I get the error
    > > type or namespace QSISMasterPage could not be found.
    > > Any Suggestions? thanks.
    > >

    >
    >
    >
     
    Paul, Feb 20, 2008
    #4
  5. Paul

    Paul Guest

    I ended up creating a masterpage class in the app code directory. I
    basically needed methods to be called each time a new page was loaded in (on
    the master page which causes the master page to reload int). These methods
    are used to change the menu depending on what page is loaded as well as
    grabing a page id.
    thanks.
    --
    Paul G
    Software engineer.


    "Elmo Watson" wrote:

    > In my estimation, you should never directly access a page of any kind in a
    > class.
    >
    > What exactly are you needing to do with the Master Page?
    >
    > David Wier
    > http://aspnet101.com
    > http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
    > bloated markup
    >
    >
    > "Paul" <> wrote in message
    > news:...
    > >I have a file called clBasePage.cs in the appCode directory (using vs 2005)
    > > and I have a master page in the root website directory called
    > > Masterpage.master.cs.
    > > In the masterpage file I have
    > > public partial class QSISMasterPage : System.Web.UI.MasterPage
    > > {
    > > }
    > > so it inherits System.Web.UI.MasterPage.
    > >
    > > The problem is that in the file clBasePage.cs I can not access the
    > > QSISMasterPage class as I tried
    > >
    > > public class clsBasePage : System.Web.UI.Page
    > > {
    > > private QSISMasterPage master; // trying to declare a private variable of
    > > type
    > > }
    > > QSISMasterPage but I get the error
    > > type or namespace QSISMasterPage could not be found.
    > >
    > > Any Suggestions? thanks.
    > > --
    > > Paul G
    > > Software engineer.

    >
    >
    >
     
    Paul, Feb 20, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Yermat

    [Classless] Just to be sure...

    Yermat, Apr 30, 2004, in forum: Python
    Replies:
    0
    Views:
    330
    Yermat
    Apr 30, 2004
  2. SCG
    Replies:
    4
    Views:
    522
    Brennan Stehling
    Sep 12, 2006
  3. Tomás Ó hÉilidhe

    Rebirthing an object... just making sure

    Tomás Ó hÉilidhe, Jan 9, 2008, in forum: C++
    Replies:
    18
    Views:
    506
    Alf P. Steinbach
    Jan 11, 2008
  4. Paul
    Replies:
    2
    Views:
    411
  5. Replies:
    0
    Views:
    558
Loading...

Share This Page