So I'm attempting to convert a website project to a web application project. I created the new web application project, moved over the files, created and populated the designer files for each ASPX and ASCX file, and included those files. Once done I ran through and corrected some smaller things here and there but all is good... except a few user controls.
So I have user controls with things like <%=Message %> in them which corresponds to a public property in the code behind class. Visual Studio now says "The name 'Message' does not exist in the current context." I've tried everything from making a new control and retyping the code to trying the newer <%: shorthand tag. Nothing seems to allow VS to "see" the property.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DoubleHrBanner.ascx.cs" Inherits="Test.ctrl.misc.DoubleHrBanner" %>
<hr class="faded" />
<span><%=Message %></span>
<hr class="faded" />
and
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Test.ctrl.misc
{
public partial class DoubleHrBanner : System.Web.UI.UserControl
{
public string Message = "";
public int Count = 0;
}
}