confusing problem with web controls

Posted on 2005-04-04
Medium Priority
Last Modified: 2010-04-07
I have an .aspx page I have created. It seems that sometimes when I add a new control (typing in the code, not dragging and dropping), especially the asp:label and asp:listbox controls, that my code-behind page does not seem to recognize them right away. For example:

I had a dropdownlist and decided to use a lisbox instead. So I removed the dropdown list and put an <asp:listbox id="lstChildrenAges" ... > in its place. My codebehind page recognized the dropdownlist fine, but right after I added the listbox control and went to my codebehind page to change the code to use the listbox instead, I get build errors in the task list that state "lstChildrenAges is not a member of ..."

I had the exact same problem with an asp:label also. Does anyone know what I need to do to resolve this?  I went ahead and just coded against the label, and at some point in started recognizing it, but those little build errors are sure annoying...

Question by:jkwasson
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 23

Accepted Solution

b1xml2 earned 1000 total points
ID: 13701246
if you want the controls to be added (be it C# or VB.NET), after you changed the items in HTML View, switch over to Designer View and that will get the controls "re-declared",

Author Comment

ID: 13701252
a little more info...

I have discovered that if I close the .aspx and .aspx.vb pages, then reopen them, the controls are now recognized and the build errors go away. This must be how the label started being recognized.... still don't know what I can do to keep from having to close and re-open the page though...

LVL 23

Expert Comment

ID: 13701274
Have you tried switching to designer mode..and then open the code behind...

Author Comment

ID: 13701275
b1xml2 - that did it! Thanks. :)

LVL 23

Expert Comment

ID: 13701283
np =))

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question