ASP.NET 2.0 Data Binding Tips - How to avoid Eval()

Here is an excellent tip to speed up ASP.NET 2.0 Data Binding by avoiding reflection overhead:

http://www.dasblonde.net/2005/08/22/ASPNET20DataBindingTipsHowToAvoidEval.aspx

If you're in a VB project then you have to use CType to cast Container.DataItem like this:

<asp:Label ID="Label3" runat="server" Text='<%# CType(Container.DataItem, ConfigurationSection).SectionInformation.SectionName %>'></asp:Label>

Another benefit of doing this early binding, if you're using VS 2005, is you get intellisense popup to aid in selecting the right property.

Comments

Popular posts from this blog

.NET generics with private accessors not compatible with MSTest

Microsoft.ApplicationBlocks. ExceptionManagement The event source x does not exist error

404 error in a REST WCF service