Reputation: 576
This used to work (on a website project). Now, we're converting to a web application project, and I can't seem to get it to work.
Very simple ascx with nothing on it and creating a public class variable in the cs file.
This is part of the code in the cs file
public partial class Test: System.Web.UI.UserControl
{
public string strThisOne = "This is the string";
protected void Page_Load(object sender, EventArgs e)
{
}
}
Now code in the ascx file (this used to work, what am I missing going forward?):
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="test.ascx.cs" Inherits="test" %>
<%= strThisOne %>
I now get an error saying that strThisOne does not exist in the current context. What changed? And how do I access the variable going forward (we used this technique a lot in the past to get values into JavaScript on the page)?
Upvotes: 0
Views: 339
Reputation: 576
OK. So, Visual Studio shows this in the editor window as an error (with red wavy underlines), but when I compile there are no errors and the page works! Seems like an issue with Intellisense...
Upvotes: 0