Does Not Exist In The Current Context Error In Asp.net
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up The name 'controlname' does not exist in the current context up vote 58 down vote favorite 11 I have a web application that I'm working on (ASP.NET2.0 with C#, using VS2005). Everything was working fine, and all of a sudden I get the error: Error 1 The name 'Label1' does not exist in the current context and 43 others of the sort for each time that I used a control in my codebehind of the page. This is only happening for 1 page. And it's as if the codebehind isn't recognizing the controls. Another interesting thing is that the intellisense isn't picking up any of the controls either.. I have tried to clean the solution file, delete the obj file, exclude the files from the project then re-add them, close VS and restart it, and even restart my computer, but none of these have worked. c# asp.net visual-studio-2005 code-behind share|improve this question edited Aug 17 '10 at 6:48 Rob 30.6k1683111 asked Apr 1 '09 at 17:34 zohair 97692137 2 The right answer to this is in the answer found here: stackoverflow.com/a/1981228/168703 –JonH Feb 3 '12 at 16:21 add a comment| 14 Answers 14 active oldest votes up vote 31 down vote accepted Check your code behind file name and Inherits property on the @Page directive, make sure they both match. share|improve this answer answered Apr 1 '09 at 17:37 CMS 453k1237487
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges http://stackoverflow.com/questions/706603/the-name-controlname-does-not-exist-in-the-current-context Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up “The name does not exist in the current context” in ASPX page up vote http://stackoverflow.com/questions/24008549/the-name-does-not-exist-in-the-current-context-in-aspx-page 1 down vote favorite 1 I've had a look at similar questions (1,2) but they don't appear to provide me a solution :S I'm trying to add an extra field to a registration form that is already pre-built (i.e. comes with) in ASP.Net Web Form. What I'm doing is, in the Register.aspx.cs backend I try to obtain the value txtCompanyInput.Text();: protected void RegisterUser_CreatedUser(object sender, EventArgs e) { ... // some code here String CompanyName = txtCompanyInput.Text(); ... // other code here Response.Redirect(continueUrl); } The Register.aspx itself looks like so: ...
ASP.NET Community Standup Forums Help Home/ASP.NET Forums/General ASP.NET/Visual Studio and Visual Web Developer Express/The name xxx Does Not Exist in the Current Context The name xxx Does Not Exist in the Current Context [Answered]RSS 59 replies Last post Jul 06, http://forums.asp.net/t/1006588.aspx?The+name+xxx+Does+Not+Exist+in+the+Current+Context 2011 01:19 PM by jleviaguirre ‹ Previous Thread|Next Thread › Print Share Twitter Facebook Email Shortcuts Active Threads Unanswered Threads Unresolved Threads Support Options Advanced Search Related Links Guidance Reply Tepi None 0 Points 4 Posts The name xxx Does Not Exist in the Current Context Jul 09, 2006 04:49 PM|Tepi|LINK I add a label to a page and set its ID to LabelEditMessage and debug, and there it is. Then in the code does not behind page (C#) I add a line of code LabelEditMessage.Text="test"; If I build, the build succeeds, but if I press the debug button it does another build that fails and tells me that LabelEditMessage Does Not Exist in the Current Context. Intellisense knows about it, and I use that to enter the reference to be sure I am not mispelling. So I tried using FindControl, and that fails with a null reference. It is there, does not exist I can see it, but Visual Web Developer refuses to acknowledge it's existence in the code behind file. If I remove the code reference it builds fine and I can see the label with its default value when i debug, but I cannot reference the label in code. I'm stumped. It's such a simple thing that I have done many times before. I just don't know what else to try. I had an almost identical problem once before in the page load event trying to set the ConnectionString property of an SqlDataSource. I tried everything I could think of for days. Then one day I deleted a validator element and it suddenly started working, and I replaced the validator and it kept on working, so I dismissed it as a fluke. But now it is back, only this time with a label rather than an SqlDataSource. Naturally, I deleted the validator element from the page again, but this time it did not make the problem go away. I'm stuck. Anybody else ever observed a similar problem? Reply Mikhail Arkh... All-Star 15483 Points 6040 Posts Re: The name xxx Does Not Exist in the Current Context Jul 10, 2006 01:57 PM|Mikhail Arkhipov (MSFT)|LINK How exactly code behind file and the page markup look like? Are you placing assignment in the Page_Load? Thanks -----------------------