Expressions in .NET
Basically this is a way of adding declarative content to a control or page or form.
This is handy as shown below for things like build information and so on. It also doesn't have to be text etc. Bind most properties to an expression.
And of course expressions are extensible.
Do it usefully in...
Application Settings
In addition to using expressions for connection strings, you can use expressions to reference application settings defined in a configuration file accessible to the Web site. For example, you might have frequently used strings, such as your site's copyright message, stored in the appSettings section of your Web.config file, which might look like the following:
<appSettings>
<add key="copyright" value="(c)Copyright 2004 Northwind Traders"/>
</appSettings>
Within your ASP.NET pages, you could reference the value by using an expression similar to the following:
<%$ AppSettings: copyright %>
This would enable you to maintain frequently cited elements within
nb
You can also use it for connectionstrings and Resource files.
Displaying Static Content Using Expressions
If you want to use an expression as a static value on your page or control, you use an expression as part of an ASP.NET server control. A typical strategy is to add a Literal control and set its Text property to an expression. For example, to place a copyright notice at the bottom of every page you could use the following:
<p align="center">
<asp:Literal runat="server" text="<%$ AppSettings: copyright %>"/>
</p>