We help IT Professionals succeed at work.

Basic .Net Concept with MasterPages and CodeBehind

Last Modified: 2012-02-15
Ok, so I have an .aspx file that is vb. I have code in the code-behind that relate to items on the .aspx page.

I get errors from time to time on the code-behind that state:

"txtxYZ" is not declared. It may be inaccessible due to it's protection level.

I cannot figure out why I cannot always reference elements on the form from the code-behind. I'm not an expert but I understand the basic concepts and it does work on other pages. This one, however, it isn't. I have run into this before and just start a new web form but I'm bothered by why it happens.

Any thoughts?
Watch Question

Web Developer
This one is on us!
(Get your first solution completely free - no credit card required)
Most Valuable Expert 2012
Top Expert 2014

Is the control on the page itself and not within another container such as gridview, repeater, datalist etc?
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.