CodeSmith Community
Your Code. Your Way. Faster!

web admin controls: 'X does not exist in current context'

Latest post 03-15-2007 11:04 AM by david849. 5 replies.
  • 07-28-2006 10:48 AM

    • trick
    • Not Ranked
    • Joined on 07-28-2006
    • Posts 4
    • Points 135

    web admin controls: 'X does not exist in current context'

    This is a really strange error, but hopefully someone has seen it before...

    I added the /Controls directory with the web admin 2.0 generated controls to my web application.  The .nettiers projects are all referenced.  I get over 1,000 errors in the web project when I build, all of them something like:

    The name 'fvEditor' does not exist in the current context.

    I checked the ascx files and the controls the compiler is complaining about are all there.  Intellisense even picks them up when I type "this." in the codebehind.  Everything seems to work if I explicitly declare the controls and use FindControl, but I haven't really been able to test it because I'd rather not fix this 1,000 times.

    Just to clairfy, fvEditor is not the only control that's producing the errors, gvList, ddlFilterColumn, and some others appear too.

    I used a nightly build of the CTP if that matters.
    • Post Points: 5
  • 07-28-2006 11:47 AM In reply to

    • trick
    • Not Ranked
    • Joined on 07-28-2006
    • Posts 4
    • Points 135

    Re: web admin controls: 'X does not exist in current context'

    It looks like the problem is a lack of .designer.cs files - the controls like fvEditor are never being declared.  (Although if I edit all the .cs files to declare them I get an error saying they've been defined twice)

    Adding new controls and copying the .ascx and .cs content from the generated files in works, but wow, what a pain.

    Any other ideas?
    • Post Points: 65
  • 07-28-2006 11:55 AM In reply to

    Re: web admin controls: 'X does not exist in current context'

    hmm, i've never run into this.  Not sure why, if you say that you just dragged and dropped into your website project.  Anyone else?

    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 5
  • 07-28-2006 12:06 PM In reply to

    • bgjohnso
    • Top 10 Contributor
    • Joined on 09-15-2005
    • Spokane, WA
    • Posts 767
    • Points 22,605

    Re: web admin controls: 'X does not exist in current context'

    Are you using a Web Site project or a Web Application project (post-release add-on to VS)?  In a web site project, there are no designer.cs files, but I think that they are added in the web application projects.  I have not done any testing using the web application projects...

    Ben Johnson
    ------------------------------
     Member of the .NetTiers team
     Visit http://www.nettiers.com
    ------------------------------

    • Post Points: 65
  • 07-28-2006 1:13 PM In reply to

    • trick
    • Not Ranked
    • Joined on 07-28-2006
    • Posts 4
    • Points 135

    Re: web admin controls: 'X does not exist in current context'

    Web Application Project - I guess that's the issue. 

    Update: Using the "Convert to Web Application" command on the imported files creates the required .designer.cs files.

    Good to know :D
    • Post Points: 30
  • 03-15-2007 11:04 AM In reply to

    • david849
    • Top 500 Contributor
    • Joined on 03-13-2007
    • Posts 12
    • Points 275

    Re: web admin controls: 'X does not exist in current context'

    Great advise!  It solved my compile problems as well.

    Is there any reason that this can't automatically be done as part of the generation of a project??

    bgjohnso:
    Are you using a Web Site project or a Web Application project (post-release add-on to VS)?  In a web site project, there are no designer.cs files, but I think that they are added in the web application projects.  I have not done any testing using the web application projects...

    Filed under: ,
    • Post Points: 5
Page 1 of 1 (6 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems