If you really want the constants in markup (not in code behind per the accepted answer), since ASP.NET 2.0 this can be done with a custom ExpressionBuilder.
First, create an ExpressionBuilder class in your web application:
namespace Your.Namespace
{
[ExpressionPrefix("Code")]
public class CodeExpressionBuilder : ExpressionBuilder
{
public override CodeExpression GetCodeExpression(BoundPropertyEntry entry,
object parsedData, ExpressionBuilderContext context)
{
return new CodeSnippetExpression(entry.Expression);
}
}
}
Then register it in your web.config:
<compilation debug="true">
<expressionBuilders>
<add expressionPrefix="Code" type="Your.Namespace.CodeExpressionBuilder"/>
</expressionBuilders>
</compilation>
Finally, call it in your markup using the <%$ %>
syntax:
<asp:RadioButtonList ID="MyRadioButtonList" runat="server">
<asp:ListItem Value="<%$ Code: CompanyName.SystemName.Constants.PaymentFrequency.FREQUENT.ToString() %>" Text="Yes" Selected="True"></asp:ListItem>
<asp:ListItem Value="<%$ Code: CompanyName.SystemName.Constants.PaymentFrequency.ONCE.ToString() %>" Text="No, Just do this once"></asp:ListItem>
</asp:RadioButtonList>
I got most of the code from here:
http://weblogs.asp.net/infinitiesloop/The-CodeExpressionBuilder
MSDN ASP.NET Expressions Overview
https://msdn.microsoft.com/en-us/library/d5bd1tad.aspx
MSDN ExpressionBuilder Class Reference
https://msdn.microsoft.com/en-us/library/system.web.compilation.expressionbuilder(v=vs.110).aspx