This is a migrated thread and some comments may be shown as answers.

How do i show related value of a foregin key guid

1 Answer 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
david
Top achievements
Rank 1
david asked on 19 Nov 2015, 02:33 PM
I am using the edmx way of entity frame work and I have a issue I want to be able to display the name of a related table instead of its value in the main column below is how I am declaring my grid and I do have a froreign key assocation as setup on db end
    <asp:ScriptManager ID="sptgrdSoccerPlayers" runat="server"></asp:ScriptManager>
     
    <telerik:RadGrid ID="grdSystemEmails" RenderMode="Auto" runat="server" AutoGenerateColumns="False"    GroupPanelPosition="Top" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" OnItemCommand="RadGrid1_ItemCommand" CellSpacing="-1" GridLines="Both" AllowAutomaticDeletes="True" DataSourceID="entyEmails">
        
        <MasterTableView  DataKeyNames="id" DataSourceID="entyEmails"  EditMode ="PopUp" >    
                <Columns>
                <telerik:GridBoundColumn DataField="id" DataType="System.Guid" FilterControlAltText="Filter id column" HeaderText="id" ReadOnly="True" SortExpression="id" UniqueName="id">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="name" FilterControlAltText="Filter name column" HeaderText="name" SortExpression="name" UniqueName="name">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="subject" FilterControlAltText="Filter subject column" HeaderText="Subject" SortExpression="subject" UniqueName="subject">
                </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="authCreatedDate" DataType="System.DateTime" FilterControlAltText="Filter authCreatedDate column" HeaderText="authCreatedDate" SortExpression="authCreatedDate" UniqueName="authCreatedDate">
                </telerik:GridBoundColumn>
                     <telerik:GridCheckBoxColumn DataField="isActive" DataType="System.Boolean" FilterControlAltText="Filter isActive column" HeaderText="isActive" SortExpression="isActive" UniqueName="isActive">
                </telerik:GridCheckBoxColumn >
                     
                     
            </Columns>
        </MasterTableView>
 
<FilterMenu RenderMode="Auto"></FilterMenu>
 
<HeaderContextMenu RenderMode="Auto"></HeaderContextMenu>
    </telerik:RadGrid>
    <asp:EntityDataSource ID="entyEmails" runat="server" ConnectionString="name=soccerEntities" DefaultContainerName="soccerEntities" EnableFlattening="False" EntitySetName="systemEmails" ></asp:EntityDataSource>

 

 

This is the screen shot of the  edmx file showing the assocation So what I want to show is the value in the  email type description value in my grid instead of its guid.

 

 

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 24 Nov 2015, 07:04 AM
Hi David,

Since there is no built-in way that could be used for achieving the desired result, what I could suggest is that you use a template column and fill the data manually by retrieving the related values, using the GUID value from each item. This could be achieved within the OnItemDataBound event for example, where you will be able to retrieve the GUID value and manually retrieve the description from your other table.

Another option is to use hierarchical grid and fill the detail tables with the email information:
Hope this helps.


Regards,
Konstantin Dikov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
david
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or