Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 06, 2011 05:19 PM by jleviaguirre
Jul 09, 2006 08:49 PM|LINK
I add a label to a page and set its ID to LabelEditMessage and debug, and there it is. Then in the code 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, 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.
Anybody else ever observed a similar problem?
Jul 10, 2006 05:57 PM|LINK
Jul 11, 2006 12:28 AM|LINK
Jul 14, 2006 03:17 AM|LINK
Jul 21, 2006 11:16 PM|LINK
Sep 15, 2006 03:27 AM|LINK
May 17, 2007 01:34 PM|LINK
cheers Tepi for posting the fix - just had a very confusing 30 minutes with the same prob - turning build off sorted it.....
Jun 02, 2007 12:26 AM|LINK
I guess you can say this post has helped one more person. I was baffled why I could not figure out what happened. I even went through all of the temporary asp.net files looking for a reason.
I sincerly appreciate you sharing this information - cheers!
Jun 11, 2007 11:26 PM|LINK
well, i had the same problem... but here is my situation and the solution: i had a file called details.aspx which was using details.aspx.cs as the code file. As soon I have created this file i said maybe i will use the layout later so i just copy-paste and
rename it as template.aspx. I continued my work on details.aspx by adding textboxes, labels etc... and methods in the .cs file. but on "Build" stage i got the magic error "The name xxx Does Not Exist in the Current Context". Reason: i was using the same .cs
file name for both template.aspx and details.aspx, but the controls were only on the details.aspx... I can imagine how confuse was the compiler... so i changed the .cs file name for the template.aspx and all build up successfully...
Jul 09, 2007 12:11 PM|LINK
Thanks for this post. I too had multiple aspx files referencing the same code behind file. I was trying to add a button to one of my aspx files and I kept getting the Does Not Exist in Current Context error. Once I excluded my other aspx files from the
IDE everything compiled. Thanks again.