The examples given below could make little sense, but it is because I am focusing on syntax.
Let's say I have such C# code:
public static class Foo
{
public const string Bar = "hello world.";
}
Now, I would like to use Foo.Bar constant in ASP.Net instead of typing each time "hello world.". So I used this syntax:
<p><%= Foo.Bar %></p>
It works. It works also in such cases:
<p>"<%= Foo.Bar %>"</p>
<p class="<%= Foo.Bar %>">the weird, nonsense example</p>
So, it works with quotes too. However I have also cases, when quotes get higher priority:
<custom:Header runat='server' Text="<%= Foo.Bar %>"/>
( header is a custom control -- it simply adds some css by default and position ). In such case quotes marks have higher priority and entire text is sucked as-is, in effect I get header with text
<%= Foo.Bar %>
So, my question is -- what is the syntax to get the value of C# constant, no matter what (IOW -- with highest priority)?
Edits:
<custom:Header runat='server' Text="<%# Foo.Bar %>"/>
(note hash instead of equal sign) does not work as well.