Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. Navigation Property Grief

Navigation Property Grief

Scheduled Pinned Locked Moved LINQ
wpfcsharpcsswcf
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tcd67
    wrote on last edited by
    #1

    Hey All, I have a seemingly simple situation with a parent-child relation (1 to Many) between a contact table and an email address table. There is FK constraint on the email table. When trying to populate the WPF data grid I’m able to grab information from the contact table but not the email address table. I’ve provided my code to see if a fresh set of eyes can quickly point out what I’m missing. Thanks. TD

    'Grab OrgID from select organization in combobox
    Dim selectedOrg As tblOrganization = CType(cboOrgList.SelectedItem, tblOrganization)
    Dim selectedOrgID As Integer = selectedOrg.idkOrganization

    'Create contact collection for the contact data grid
    Dim contactQuery As ObjectQuery(Of tblContact) = From c In yeslerContext.tblContacts.Include("tblContactEmail") _
    Where c.tblOrganization.idkOrganization = selectedOrgID _
    Select c
    Me.dgContacts.ItemsSource = contactQuery.ToList()

    dg:DataGrid.Columns
    <dg:DataGridTextColumn Header="First" Binding="{Binding Path=vchFirstName}"/>
    <dg:DataGridTextColumn Header="Last" Binding="{Binding Path=vchLastName}"/>
    <dg:DataGridTextColumn Header="Initials" Binding="{Binding Path=vchInitials}"/>
    <dg:DataGridTextColumn Header="Email" Binding="{Binding Path=vchEmail}"/>
    <dg:DataGridTextColumn Header="Start Date" Binding="{Binding Path=sdtStartDate}" />
    </dg:DataGrid.Columns>

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups