How do i show related value of a foregin key guid

2 posts, 0 answers
  1. david
    david avatar
    4 posts
    Member since:
    Nov 2015

    Posted 19 Nov 2015 Link to this post

    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.

     

     

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 24 Nov 2015 Link to this post

    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
Back to Top