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

Show/Hide formatting text in MS Word 2010

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

ASP.NET 2.0 DropDownList EnableViewState