As you probably know, DataBinder.Eval uses late-bound reflection which has a performance penalty over the explicit databinding syntax. Some articles claim DataBinder.Eval is 20% slower or more.
On the other hand, this code:
<%# DataBinder.Eval(Container.DataItem, "NewsItemContent[0].Title") %>
looks a lot nicer than this code:
<%# ((NewsItemContent)((NewsItem) Container.DataItem).NewsItemContent[0]).Title %>
An alternative is to have a function in the codebehind to do the casting:
protected NewsItemContent GetItemContent(object dataitem)
{
return (NewsItemContent) ((NewsItem) dataitem).NewsItemContent[0];
}
and then:
<%# GetItemContent(Container.DataItem).Title %>
I think perhaps the last option is probably the best one, since you have both early binding and reasonably looking code in the aspx page.
What do you use?