Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

Error: name 'lblSubTitle' is not declared

$
0
0

Hi,

I don't know but this is a really simple error.  When I create a hyperlink or any object in the html, and try to use it in the code behind, it saysname 'objectName' is not declared.  When I try to use say a label in the codebehind lblTest, after I put a .(dot) after it, the property and methods list should pop up, but it doesnt since object is not recognized.  I don't have a problem with all the other objects that were previously created, just the ones that I add now aren't being recognized.  In the previous versions of visual studio, the controls were added at the top after the line:

Inherits System.Web.UI.Page

For example, if I had a label control in the html part named lblTest, it would place the following line in the code behind:

ProtectedWithEvents lblTestAs System.Web.UI.WebControls.Label

However, this is not seen in the 2005 version.  Is that the reason the conrol is not being recognized?...Do I have to explicitly place these lines of code for every control I add to the page?  It doesnt seem like it since all the other controls that I previously created on this page don't have these lines of code and I can access them.   Thanks for your help,


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>