Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

confusing problem with web controls

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...

Thanks!
0
jkwasson
Asked:
jkwasson
  • 3
  • 2
1 Solution
 
b1xml2Commented:
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",
0
 
jkwassonAuthor Commented:
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...

thanks.
0
 
b1xml2Commented:
Have you tried switching to designer mode..and then open the code behind...
0
 
jkwassonAuthor Commented:
b1xml2 - that did it! Thanks. :)

jk
0
 
b1xml2Commented:
np =))
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now