DeveloperBarn Forums

DeveloperBarn

Programming & IT forum

class name is ambiguous

This is a discussion on class name is ambiguous within the .Net Development forums, part of the Programming & Scripting category; I keep getting errors saying "master_pc is ambiguous in the namespace 'ASP' when loading some of my pages. master_pc is ...

Go Back   DeveloperBarn Forums > Programming & Scripting > .Net Development

  #1  
Old May 19th, 2008, 10:01 AM
richyrich's Avatar
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,345
Blog Entries: 6
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
Default class name is ambiguous

I keep getting errors saying "master_pc is ambiguous in the namespace 'ASP' when loading some of my pages.

master_pc is the name of my main Public class in my Master Page.

The Error is on line:
Code:
Public Shadows ReadOnly Property Master() as ASP.master_pc
Could someone give me an idea of how to fix this other than renaming the class? There is no other class called this, so I'm at a loss as to why it's having a problem.

<edit>The file it references is App_Web_..... which I presume is one created by .Net during compilation</edit>

Last edited by richyrich; May 19th, 2008 at 10:05 AM.
Reply With Quote
  #2  
Old May 19th, 2008, 10:11 AM
richyrich's Avatar
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,345
Blog Entries: 6
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
Default

If I change the properties in the Master Page to shared then I get another ambiguous error saying "master_pc is ambiguous".

This time it relates to code in my content page that's trying to access a shared property in the master page.
Code:
master_pc.connString
Where am I going wrong?

I've only started having this problem recently...
Reply With Quote
  #3  
Old May 19th, 2008, 10:19 AM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Real name: Jason
Location: Washington, D.C.
Posts: 1,964
Blog Entries: 8
Rep Power: 15
jmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud of
Default

See this: '<name>' is ambiguous in the namespace '<namespacename>'

If it doesn't work, then try renaming it.
__________________
jmurrayhead
If you agree with me... click the icon!
If my post solved your problem, click the button in the lower right-hand corner of the post.

If you like it here...throw us a few bones to help
support us.

Join our Folding team: DeveloperBarn Folding

Reply With Quote
  #4  
Old May 19th, 2008, 10:41 AM
richyrich's Avatar
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,345
Blog Entries: 6
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
Default

Hmmm....I renamed it before when I had this problem. Renamed it again and it's working again.

Now I'm getting another error, "Nullable object must have a value" on one of my date fields, even though the field in the db does have a value in it and I'm using if not isdbnull(rs("dateadded")) then to populate the field......
Reply With Quote
  #5  
Old May 19th, 2008, 10:45 AM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Real name: Jason
Location: Washington, D.C.
Posts: 1,964
Blog Entries: 8
Rep Power: 15
jmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud of
Default

Remove this:
Code:
if not isdbnull(rs("dateadded")) then
It's a Nullable type, so you don't have to do this check.
Reply With Quote
  #6  
Old May 19th, 2008, 10:47 AM
richyrich's Avatar
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,345
Blog Entries: 6
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
Default

I tried making a change to fix the date problem and now it's saying the name of the class in my Master page is ambiguous again...

This is doing my head in!!!!!!
Reply With Quote
  #7  
Old May 19th, 2008, 12:12 PM
richyrich's Avatar
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,345
Blog Entries: 6
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
Default

OK. I think I may have solved this issue, fingers crossed.

It seems that if the class of my content page was set to partial, I got the error. If I set it to Public, it stopped the error.

I had a similar issue with a user control. I removed the ClassName attribute from the Control declaration and kept the class as Partial and that seemed to solve that.

Fingers crossed this won't start happening again now...

Just a note J. On the date fields, if I have a field value as NULL and I don't have if not isdbnull() it threw an error. Damn annoying...
Reply With Quote
  #8  
Old May 19th, 2008, 12:34 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Real name: Jason
Location: Washington, D.C.
Posts: 1,964
Blog Entries: 8
Rep Power: 15
jmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud of
Default

That's odd, because I have a property:

Code:
Private _myDate As Nullable(Of Date)
Public Property MyDate() As Nullable(Of Date)
    Get
        Return _myDate
    End Get
    Set(ByVal value As Nullable(Of Date))
        _myDate = value
    End Set
End Property
And this works when passing NULL dates.

As far as the declaration of your class...you should be able to keep it as Partial...there must be something else wrong with your code.
Reply With Quote
  #9  
Old May 19th, 2008, 12:52 PM
richyrich's Avatar
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,345
Blog Entries: 6
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
Default

Must be...It's just happened again with the class set to Public.

How do I find out what the "real" problem is, because it's obviously not that the class name is ambiguous?

Maybe I'll try re-jigging things, so the shared properties I want are in my BO layer. See if that helps.
Reply With Quote
  #10  
Old May 19th, 2008, 12:57 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Real name: Jason
Location: Washington, D.C.
Posts: 1,964
Blog Entries: 8
Rep Power: 15
jmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud of
Default

is ambiguous in the namespace 'ASP'
Reply With Quote
Reply

  DeveloperBarn Forums > Programming & Scripting > .Net Development

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Class library Shem .Net Development 11 May 22nd, 2008 07:01 AM


All times are GMT -4. The time now is 01:44 AM.


Copyright ©2008-2010, DeveloperBarn

Content Relevant URLs by vBSEO 3.3.2