Reputation: 5788
I have a simple .ascx page that looks like this:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ctl_dataLookup.ascx.cs" Inherits="ctl_dataLookup" %>
<div>
<h1>Data Lookup</h1>
<p><%= d1 %></p>
</div>
The code behind page looks like this, and DoDataLookup method is called at the start of running this page:
public partial class ctl_dataLookup : BaseDomainControl
{
private string d1;
public string D1 { get { return d1; } }
protected void Page_Load(object sender, EventArgs e)
{
this.Visible = false;
this.DataBind();
}
public void DoDataLookup(int DomainId, string DomainName)
{
this.Visible = true;
d1 = "TEST DOMAIN";
}
}
However, the <%= d1 %> always ends up looking like this when the page is rendered (System.Web.UI.WebControls.Label):
I've looked at countless examples of this on Stack Overflow, but it looks as though I'm doing everything right... Is there any obvious reason why this is happening?
Upvotes: 1
Views: 2927