Reputation: 63
I'm working on a grid where I want show not the value of the connected foreign key but it should not look like (1,2,3,57
etc) that is already working ... I want to show really the value behind the numbers like (test,lead,foo,bar
etc..) I think that should be possible
I'm using Entity Framework 5.0 with asp.net 4.5
My EntityDataSource
:
<asp:EntityDataSource ID="EntityDataSource1" runat="server"
ConnectionString="name=zevtestEntities" DefaultContainerName="zevtestEntities"
EnableFlattening="False" EntitySetName="BU"></asp:EntityDataSource>
I have already tried:
<telerik:GridBoundColumn
DataField="ZevUser.FirstName" FilterControlAltText="Filter Creator column"
HeaderText="Creator" ItemStyle-Width="60px" SortExpression="Creator" UniqueName="Creator">
<ItemStyle Width="60px" />
</telerik:GridBoundColumn>
And ZevUser
is the source table where the values are stored as text, is there another way to do it?
Upvotes: 5
Views: 1243
Reputation: 1144
You almost have it. You can reference the related entity in EF using the include property in your EntityDataSource. Try Include="ZevUser" after your EntitySetName. See the below link for more information.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.entitydatasource.include.aspx
Upvotes: 4