Databinding syntax is powerful, it enables a declarative way to assign values to a control.  For example,
<asp:Label runat="server" Text="<%# DateTime.Now %>" />

It will display today's date. It also allows you to call methods that returns any values bindable to the property of the control:

<asp:Label runat="server" Text="<%# MyCustomDateFormat(DateTime.Now) %>" Visible="<%# SomeMethodReturnsBoolean() %>" />
<asp:Label runat="server" Text="<%# MyCustomDateFormat(DateTime.Now) %>" Visible="<%# SomeMethodReturnsBoolean(sender) %>" />
Advertisements