Should one bind data with Eval on aspx or override ItemDataBound in code-behind?
<p>For data bound controls (Repeater, ListView, GridView, etc.), what's the preferred way of binding data?</p>

<p>I've seen it where people use Eval() directly on the aspx/ascx inside the data bound control to pull the data field, but to me, it just seems so...inelegant. It seems particularly inelegant when the data needs to be manipulated so you wind up with shim methods like <code>&lt;%# FormatMyData(DataBinder.Eval(Container.DataItem, "DataField")) %&gt;</code> inside your control.</p>

<p>Personally, I prefer to put in Literal controls (or other appropriate controls) and attach to the OnItemDataBound event for the control and populate all the data to their appropriate fields in the code-behind.</p>

<p>Are there any advantages of doing one over the other? I prefer the latter, because to me it makes sense to compartmentalize the data binding logic and the presentation layer. But maybe that's just me.</p>
