Does not contain a definition for an object, but the object is there!

Posted on 2007-07-30
Last Modified: 2013-11-26
I am running into a problem I can't seem to solve.

I am using Visual Studio 2005 and have a fairly large webform solution in development. On one of my webforms I have added objects, a grid view and sqldatasource if it matters. when I am coding the tool tips helper sees the objects when I am typing, showing me all their methods/properties/etc;; but when I compile the code I get "AdminDivision does not contain a definition for 'sdsDDLApprovers'". However, when I answer yes to continue at compilation to continue on and view the web solution the page works fine, I can even use the object that are throwing the error when compiling in VS 2005!! AdminDivision is the webform and sdsDDLApproveres is an SQLDataSource placed on the webform. I have other gridviews and sqldatasources on the webform, clearly named differently, and which don't throw errors when compiling. and I am not missing a method or anything like that, I believe, its the actual object as stated in my quote above that is throwing the error.

I have looked to see if there is some way to get to the generated code, the 'hidden' generated code in VS 2003 that handled all the object creations/instantiations, but I can't seem to get to it in VS 2005.

Soooo, What is my problem? And IS there hidden code that you can edit in VS 2005 that I can't find?

I will be glad to post code, files, pics, etc. but it would seem to me a more general problem concerning VS 2005. I just don't get how it can be throwing an error butr still work when I go past the errors!
Question by:Jenslove
    LVL 22

    Expert Comment

    > However, when I answer yes to continue at compilation to continue on

    Are you sure the question is if you want to continue? I think it asks you if you want to run the last successful build.

    Author Comment

    Ah, you are correct; it is the last successful build.

    But I can still SEE the objects on the page, I have checked spelling several times, and the object listbox (not sure what its offical name is) that helps you complete object names see the gridview and datasource.

    I am just stumped.

    I took all the elements and put them on a new, test page and the same exact code works fine. when I put them back onto the page I need them on it doesn't work.

    I will post anything you ask for. I'm just not sure what more would help you determine what I'm doing wrong. :\

    Author Comment

    Also, if I add a simple button to the webform it can't compile because the compiler can't 'see' the 'Button1' object.

    Its like the webform has reached a limit and nothing more can be added to it; or the part that connects objects across aspx and aspx.cs is corrupt or bad. I know in VS 2003 I could go into the hidden region and alter/change things, but in VS 2005 there is no such place...or am I missing something?

    And thanks for the reply, sorry I was so late in replying myself.

    I appreciate any and all help.
    LVL 22

    Accepted Solution

    Okay, are you sure the aspx and aspx.cs pages are linked together correctly? Check the codebehind file name in the header row of the aspx file...


    Author Comment

    I resolved the problem, though I still don't know WHAT the problem was.

    I took the pertinent code and placed it into a new webform and it worked fine; so after this test I took all the code from the aspx and aspx.cs and made a new webform. This fixed the problem so I am moving on.

    I have acknowledge you as the solution provider as you were the only one kind enough to answer. I appreciate your time!

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now