Namespace error

Last post 11-07-2009 10:50 PM by AmyZ. 2 replies.

Sort Posts:

  • Namespace error

    11-07-2009, 7:49 PM
    • Member
      24 point Member
    • AmyZ
    • Member since 11-24-2007, 11:28 AM
    • Posts 73

    Hi guys,

    I'm getting an error:

    The type or namespace name 'DefaultLayoutMain' does not exist in the namespace 'StockHill.Web.MasterPages' (are you missing an assembly reference?)

    and (I think related) error:

    'object' does not contain a definition for 'Master'


    This is my code:

    public new StockHill.Web.MasterPages.DefaultLayoutMain Master {
                get {
                    return ((StockHill.Web.MasterPages.DefaultLayoutMain)(base.Master));
                }


    Any idea what I've done wrong?

    Many thanks

  • Re: Namespace error

    11-07-2009, 9:16 PM
    • All-Star
      27,096 point All-Star
    • PeteNet
    • Member since 01-21-2009, 1:15 PM
    • Posts 3,860

    you're probably missing "using" the namespace 'StockHill.Web.MasterPages' on the class (file) for "DefaultLayoutMain"  ?  I mean, have you included the namespace there?

    Regards,
    Peter
  • Re: Namespace error

    11-07-2009, 10:50 PM
    • Member
      24 point Member
    • AmyZ
    • Member since 11-24-2007, 11:28 AM
    • Posts 73

    Hi Peter,

    Thanks so much for your reply. I'm really stuck on this. (And relatively new to coding).

    I've actually taken the files off another server (where it was working fine) and trying to re-create it in visual studio. But I'm not finding it easy!

    Sorry for stupid question, but if the DefaultLayoutMain.master.cs file contains the namespace, do I still have to include it as 'using'?

    My DefaultLayoutMain.master.cs file starts (after all the other 'usings') with:

    namespace StockHill.Web.MasterPages
    {
        public partial class DefaultLayoutMain : System.Web.UI.MasterPage
        {

    This is then one of the cs files (default.aspx.designer.cs) I'm getting the error on:

    namespace StockHill.Web {
        
        public partial class Default {
            
            /// some code, but below is where I get the error....

            public new StockHill.Web.MasterPages.DefaultLayoutMain Master {
                get {
                    return ((StockHill.Web.MasterPages.DefaultLayoutMain)(base.Master));
                }
            }
        }
    }


    Any help greatly appreciated! Smile


Page 1 of 1 (3 items)