Archive for April, 2008

Data Binding to Key-Value Based Collections in ASP.NET

This is as much a note for me as anything as every time I need to data-bind a control to a Hashtable or a Dictionary<TKey, TValue> I always find myself reaching for Google.

When data-binding to a key-value based collection you output data as follows:

  • <%# Eval("Key") %> or
  • <%# Eval("Value") %>

Simple really.

No Comments