ASP.NET Error when referencing a code-behind variable

Posted by mattgcon on Stack Overflow See other posts from Stack Overflow or by mattgcon
Published on 2010-06-12T08:21:05Z Indexed on 2010/06/12 8:33 UTC
Read the original article Hit count: 357

Filed under:
|
|
|

I have an aspx page that is supposed to reference a code-behind variable but I am receiving an error of "The name [variable] does not exist in the current context"

Here is the aspx code

<%@ Control Language="C#" AutoEventWireup="true" Inherits="IPAM.Website.Controls.controls_event_header" Codebehind="event_header.ascx.cs" %>
<%# strEventLink %>
<h3><%# strEventDate %></h3>
<%# strLinks %>

Here is part of the aspx.cs code declaring those variables:

public string strEventLink = "";
public string strEventDate;
public string strLinks = "";

Here is the part of the aspx.cs code where it sets those variables:

strEventLink = "<h2>" + parent.Name + "</h2>";
strLinks += "<p><font size=\"+1\"><a href=\"" + Page.ResolveUrl("~" + strScheduleLink) + "\"><b>" + strScheduleLinkText + "</b></a></font></p>\n";
strEventDate = ei.DateSpan;

Please help me with this problem

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about variables