Binding Complex Properties to GridView
1 min read
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"> <ItemTemplate> <asp:Label ID="FromTagTitle" runat="server" Text='<%# Eval("FromTag.Title") %>'></asp:Label> </ItemTemplate></asp:TemplateField> Share:
Share on LinkedIn
Quick Share: Your custom post text has been copied to your clipboard! Click the button below to open LinkedIn's share dialog, then paste it.
💡 Tip: LinkedIn will open in a new tab. Use Ctrl+V (or Cmd+V on Mac) to paste your text.
Note: LinkedIn will show the article preview. You can add your custom text above it.