If this applies to a DataBound control where you are binding to some list or anonymous IQueryable, you should be able to use Eval("Bar") since Foo is already specified in bind.
Edit:
If you want to use the notation <%# %> , look at your update, you can leave with it using Container.DataItem .
<%# ((Foo)Container.DataItem)["Bar"] %>
source share