The name 'ControlName'does not exist in the current context

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nudrat
    New Member
    • Aug 2007
    • 38

    The name 'ControlName'does not exist in the current context

    I included a control TextBox with 'txtError' name. whenever I build this I get this error.
    The name 'txtError' does not exist in the current context
    But its running on last successful Build.
    I tried deleting deafult.aspx page from project, then building the project, then adding again the deafult.aspx in Project. But nothing worked.
    Please find the solution for that.

    Thanks & Regards
    Nudrat
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    That really does not tell us much, since we know nothing of your project.
    First off, when you look at the default.aspx page that has the aspx code, you see your textbox with the correct ID of "txtError" ?
    Second, the only place that is valid, will be the default.aspx scope.
    default.aspx and either default.aspx.vb or default.aspx.cs , depending on your choice of language.

    So if you could verify those two points perhaps outline a few more details about you problem, it would help us answer your question better.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Originally posted by Plater
      That really does not tell us much, since we know nothing of your project.
      First off, when you look at the default.aspx page that has the aspx code, you see your textbox with the correct ID of "txtError" ?
      Second, the only place that is valid, will be the default.aspx scope.
      default.aspx and either default.aspx.vb or default.aspx.cs , depending on your choice of language.

      So if you could verify those two points perhaps outline a few more details about you problem, it would help us answer your question better.
      If this is an ASP.NET application, check the Default.aspx.de signer.vb (or cs) to make sure that your text box has properly been registered.

      Please note that this file doesn't exist if you are developing an ASP.NET website.

      Comment

      • nudrat
        New Member
        • Aug 2007
        • 38

        #4
        Hi..
        I have the correct ID for TextBox "txtError" and it is in the scope of default.aspx.cs page.


        Originally posted by Plater
        That really does not tell us much, since we know nothing of your project.
        First off, when you look at the default.aspx page that has the aspx code, you see your textbox with the correct ID of "txtError" ?
        Second, the only place that is valid, will be the default.aspx scope.
        default.aspx and either default.aspx.vb or default.aspx.cs , depending on your choice of language.

        So if you could verify those two points perhaps outline a few more details about you problem, it would help us answer your question better.

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          So somewhere, there is a piece of code that is trying to use that name but cannot.
          Since error messages always allow you to go to the offending line, have you looked at where it tells you to go?

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Originally posted by nudrat
            Hi..
            I have the correct ID for TextBox "txtError" and it is in the scope of default.aspx.cs page.
            Could you please post both the ASP and C# code to do with the TextBox so that we can see what's going on?

            Comment

            Working...