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

M

Monty

Hello,

[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.
MasterPage.master.vb

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

Monty
 
M

Monty

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?
 
W

Walter Wang [MSFT]

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?

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
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
promptly.

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
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top