ASP.NET Expression Builders - Part 1

Some linkage first:

Put basically, expression builders allow you to "intercept" the ASP parser before it starts actually processing server tags and thus insert code into the C# that's generated by the markup, so you can set the values of properties in the markup, rather than doing it in the Page_Load, or similar, method.

For example:

<asp:Literal runat="server" Text="<%$ MyExpressionBuilder: my.key.that.gets.handled %>

In a product I'm working on I'm planning on using it to implement database backed localisation for UI strings. The current solution has all pages inherit from a base page that provides an abstract "SetLocalisedStrings" method which gets called and is responsible for setting all the relevant ".Text" properties of various controls. Clunky, and it separates the localisation keys from the actual controls making it hard to match-up what goes where.

About Rob

I've been interested in computing since the day my Dad purchased his first business PC (an Amstrad PC 1640 for anyone interested) which introduced me to MS-DOS batch programming and BASIC.

My skillset has matured somewhat since then, which you'll probably see from the posts here. You can read a bit more about me on the about page of the site, or check out some of the other posts on my areas of interest.

No Comments

Add a Comment