I am trying to use CDN for my images on the website. Problem is, sometimes I have server controls such as ImageButton, and I would like to use a class in order to fully extr
You can evaluate code in a server tag by creating your own Code Expression Builder. It's quite simple.
[ExpressionPrefix( "Code" )]
public class CodeExpressionBuilder : ExpressionBuilder
{
public override CodeExpression GetCodeExpression( BoundPropertyEntry entry, object parsedData, ExpressionBuilderContext context )
{
return new CodeSnippetExpression( entry.Expression );
}
}
And an entry in your web.config:
This allows you to use a syntax such as:
Here's a full explanation: http://weblogs.asp.net/infinitiesloop/archive/2006/08/09/The-CodeExpressionBuilder.aspx