Binding Complex Properties to GridView

Binding simple (int/string, etc) type properties to a TemplateColumn in a GridView is easy, but when you need to bind the Grid to an object that has properties that aren’t simple types it gets a bit more complex. The Bind method only works with simple types, so you need to use the Eval method and the dot operator to get the values from the complex type property.

<asp:TemplateField HeaderText="From Tag">
<asp:Label ID="FromTagTitle" runat="server" Text='<%# Eval("FromTag.Title") %>'></asp:Label>