In ASP.Net 4.5 Web Forms, I have a grid which uses the new Model Binding feature, backed from Entity Framework:
<asp:GridView runat="server" ID="uxGrid" ItemType="SAData.SelfAssessment" DataKeyNames="SelfAssessmentID" AllowPaging="True" AllowSorting="True" PageSize="2"
SelectMethod="GetSelfAssessments" CellPadding="5" ForeColor="#333333" GridLines="None" AutoGenerateColumns="False">
This duly lists out all Assessments within the DB, including their destination, which is a FK to the obviously-named Destination table. The DynamicField is set to display the DestinationID, but I really want to see the Destination name from the actual Destination table.
I've tried a couple of variations, e.g.
<asp:DynamicField DataField="Destinations.DestinationDescription" HeaderText="Destination" />
(where Destinations is the table)
and
<asp:DynamicField DataField="Destination.DestinationDescription" HeaderText="Destination" />
(where Destination is the Navigation property).
Both methods result in "The table 'SelfAssessment' does not have a column named 'Destinations.DestinationDescription'." or similar.
My GetSelfAssessments method uses the .Include method to, well, include the Destinations table, but to no avail.
Any thoughts?