470,831 Members | 2,441 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,831 developers. It's quick & easy.

Control in Master Page.. "Name lblStatus is not declared"


[ASP.Net, VS2005] I have a label control in my master page like this:
<asp:Label ID=lblStatusMessage runat="server"></asp:Label>

When I reference the control in my code-behind I get this error
"Name 'lblStatusMessage' is not declared"

If I add a declaration for it at the top of my partial class like so:
Protected lblStatusMessage As System.Web.UI.WebControls.Label

then I get this error:
'lblStatusMessage' is already declared as 'Protected Dim WithEvents
lblStatusMessage As System.Web.UI.WebControls.Label' in this class.

This happens even I drag a control into the masterpage from the toolbox. Any
ideas?? Thanks!


Dec 28 '06 #1
2 3186
I am using Web Application Projects, and it appears that this master page
does not have a designer (I have "show all docs" turned on, and I can see
the vb class but not the designer). Not sure where it went, or how I could
create a new one?
Dec 28 '06 #2
Hi Monty,

Based on my understanding, you're having trouble to correctly add controls
to the master page and reference them in code-behind.

I just tried it on two different VS2005: one with the Web Application
Project add-on, one with VS2005 SP1 (which already integrated the Web
Application Project add-on); both work correctly for the master page and
show the .master.designer.vb correctly in solution explorer.

Does this issue only exists in one of your project or it exists in even a
simplest new project?

Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Get notification to my posts through email? Please refer to
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at

This posting is provided "AS IS" with no warranties, and confers no rights.
Dec 28 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Alfred E Neuman | last post: by
4 posts views Thread by Dan Jacobson | last post: by
2 posts views Thread by TJS | last post: by
3 posts views Thread by JohnJohn | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.