I have this code in my ASP page:
<%@ Register TagPrefix="genies" Namespace="TheNamespace" Assembly="TheAssembly"%>
...
<% string name = GetTag().Name; %>
<div class="<%= name %>"></div>
<genies:BarGenie ID="BarGenie1" runat="server" Title="<%= name %>" />
The BarGenie class has the following code:
public class BarGenie : Control {
public string Title { get; set; }
protected override void Render(HtmlTextWriter writer) {
writer.Write("<div>" + Title + "</div>");
}
}
This is the HTML that is generated:
<div class="E00383"></div>
<div><%= name %></div>
I'd like to see this HTML:
<div class="E00383"></div>
<div>E00383</div>
I've tried various things in the ASPX code: @name, <%# name %> etc but I can't figure out what's going on. Is there some other way of inserting a custom control that I should be using? Do I have the wrong approach to using this custom control?