Tip 5 : The name ‘ErrorMessageLabel’ does not exist in the current context

 At Siverlight application test page, you add an ASP.NET label control:

      <asp:Label ID="ErrorMessageLabel" runat="server" ForeColor="Red"></asp:Label>

Then, at the code behind, you put:

      ErrorMessageLabel.Text = "Error Occurred";

But when you move the cursor on the ErrorMessageLabel at the code behind, you notice the following message is displayed: The name ‘ErrorMessageLabel’ does not exist in the current context.

It is because that your test page is part of a web application project and it needs .aspx.designer.cs file.

To solve this issue, point to and right click your test page, then click “Convert to Web Application”. The Visual Studio 2008 IDE adds .aspx.designer.cs file for you and the error message disappears.

 

10 Comments

Comments have been disabled for this content.