The name xxx Does Not Exist in the Current Context

Last post 11-14-2009 5:04 PM by MargaritaRosa. 43 replies.

Sort Posts:

  • Re: The name xxx Does Not Exist in the Current Context

    05-06-2009, 7:39 PM
    • Member
      22 point Member
    • Gewgala
    • Member since 07-26-2007, 9:18 PM
    • Posts 71
    Do you clean your project prior to building it?
  • Re: The name xxx Does Not Exist in the Current Context

    05-06-2009, 8:24 PM
    • Member
      8 point Member
    • konic
    • Member since 05-06-2009, 8:48 PM
    • Posts 4
    Gewgala:
    Do you clean your project prior to building it?
    I cleaned project and deleted all folders in the ..\roor\" folder.
    And still have to use casting just to be able to compile the code.
    ...
    P.S. OK, the mystery is solved. By mistake I deleted Default.aspx.designer.cs file,
    which contains definitions of all class members.
  • Re: The name xxx Does Not Exist in the Current Context

    05-13-2009, 10:00 AM
    • Member
      12 point Member
    • Ramya N
    • Member since 04-30-2009, 7:10 PM
    • Posts 10

    Check if you are pointing the same code behind file in two different apsx forms, i found this answer in another forum and solved my problem, when faced similar one.

  • Re: The name xxx Does Not Exist in the Current Context

    07-01-2009, 4:54 PM
    • Member
      2 point Member
    • jtaylorwehco
    • Member since 01-29-2009, 6:47 PM
    • Posts 3

    Brad,

    I found out that if you rename the .aspx and the .aspx.cs file, rebuild web site, and rename the files back to the originals, the error goes away.

    - jtaylorwehco

  • Re: The name xxx Does Not Exist in the Current Context

    08-17-2009, 1:41 AM
    • Member
      224 point Member
    • hellowahab
    • Member since 10-30-2008, 12:09 PM
    • Pakistan
    • Posts 91

    Let see if it works for me!

    W-H
    Please remember to click “Mark as Answer” on the post that helps you,and to click “Unmark as Answer” if a marked post does not actually answer your question.

  • Re: The name xxx Does Not Exist in the Current Context

    08-17-2009, 1:47 AM
    • Member
      224 point Member
    • hellowahab
    • Member since 10-30-2008, 12:09 PM
    • Pakistan
    • Posts 91

    Let see if it works for me!

    W-H
    Please remember to click “Mark as Answer” on the post that helps you,and to click “Unmark as Answer” if a marked post does not actually answer your question.

  • Re: The name xxx Does Not Exist in the Current Context

    08-19-2009, 1:23 AM
    • Member
      9 point Member
    • jcevans
    • Member since 06-10-2009, 3:21 AM
    • Posts 10

     Well, I am getting the same error message, but for a different reason. 

     - I tried the first suggestion above, change the build options.  That did not work. 

     - I do not have any other copies of pages with the same names, so that rules that out.

    I am reasonable certain my problem is because the upload control i am using (the control that generates the error message) is buried so far down in the templates of my GridView that simply putting the control name in the code behind does not fully address it.  When i put the fileupload, with this name outside of the GridView it works fine.  But, when it is in the InsertItem template of one of the Fields, it generates this message.

    I am hoping i just need to learn how to address the control properly in the code behind.  Perhaps

    instead of

    fupEventLogo.enabled = true;

    I need something like

    gvEventInformation.Field6LogoUploadFilename.InsertItemTemplate.fupEventLogo.enabled = true;

     or close to that.  (This example does not work, but i'll bet it is moving in the right direction!)

    I will just keep trying variations until I get it or i successfully address in the controls collection

    If you have any suggestions, i would love to hear them!

     

    Jon

  • Re: The name xxx Does Not Exist in the Current Context

    08-25-2009, 11:05 PM
    • Member
      9 point Member
    • jcevans
    • Member since 06-10-2009, 3:21 AM
    • Posts 10

     Hi,

    I was correct, same problem but for a totally different reason.  So, incase someone else runs into this issue, I will share what I learned.

    I was on the right track that the issue was due to the FileUpload control being inside the DetailsView Control.  This made it so that my code could not directly access the FileUpload.  But, i was wrong, i could not fully qualify the name of the control to access it like I used to in VB (VB2 through VB6).  I needed to use the FindControl Method.  For this, in my code behind, I created a new Control of the type FileUpload and set it equal to the one in my web page.  Here is the csharp code i used

    FileUpload FileLogo2Upload = (FileUpload)dvEventInformation.FindControl("fupEventLogo");

    The syntax for including the control type in ( ) seemed a bit odd to me, but it works.

    Now, in my code behind, whenever I needed info about the original control, I accessed it from FileLogo2Upload

    I also had RadioButtons in the template in the DetailView, so I created a new control for each of them, using Find Control so i could access the info from the new control to see which was checked.

    Hope this helps someone

    Jon

     

     

     

    Filed under:
  • Re: The name xxx Does Not Exist in the Current Context

    08-27-2009, 10:29 AM
    • Member
      34 point Member
    • hellobiswa2001
    • Member since 08-16-2009, 6:09 AM
    • Rajkot(Now)
    • Posts 15

    The id of the lbl cotrol must be different therefor it shows the error, to find this go to the code behind page and type the lebel name , it must nit be displayed..





    Gud Lick
    By : Biswa
  • Re: The name xxx Does Not Exist in the Current Context

    08-27-2009, 1:38 PM
    • Member
      2 point Member
    • CodePartizan
    • Member since 08-05-2009, 9:39 PM
    • In an Octopus' Garden
    • Posts 4

     Well, this problem seems to have a multitude of problems and solutions. Here's another one that may be indicative of others and hasn't been mentioned yet.

    If you add a control IN something.aspx where something.aspx.designer.cs also exists, you have to add the control in something.aspx.designer.cs in the following manner

    protected global::System.Web.UI.WebControls.Label labelName;


    of course replacing the control type with what you need.

    (at least this works for me on VS2005 SP1)

     

    Cheers,

    Partizan

  • Re: The name xxx Does Not Exist in the Current Context

    08-28-2009, 11:03 AM
    • Member
      292 point Member
    • ravensensei
    • Member since 04-05-2006, 1:34 PM
    • Posts 110

    the other thing I noticed after wrestling with some of the suggested solutions is that if I don't open it as a project and I open it as a website in VS2008, it runs fine.

  • Re: The name xxx Does Not Exist in the Current Context

    10-08-2009, 6:57 AM
    • Member
      14 point Member
    • UptownGirl
    • Member since 10-07-2009, 11:02 AM
    • Posts 7

    Read all the entries about duplicates in back up files and thought that's embarressing and was certain that wasn't my problem!

    Embarassed Do a find of the entire project to make sure!!  Even though the name in the solution explorer is different, it doesn't change it in the code behind file.

  • Re: The name xxx Does Not Exist in the Current Context

    10-29-2009, 12:15 PM
    • Member
      3 point Member
    • sumanabk
    • Member since 07-30-2009, 4:35 PM
    • Posts 5

    Thank you so much for this post. I spent a good deal of time trying to figure out the problem before

    I check on the forums. How silly of me..hehee..I had the back up copy too. Once I excluded everything

    else worked fine. :)

  • Re: The name xxx Does Not Exist in the Current Context

    11-14-2009, 5:04 PM
    • Member
      2 point Member
    • MargaritaRosa
    • Member since 11-14-2009, 5:01 PM
    • Posts 1

    Thank you jcevans this worked for me 

Page 3 of 3 (44 items) < Previous 1 2 3