Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6255909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:27:07+00:00 2026-05-24T14:27:07+00:00

I am Using LINQ to query a table that has a foreign key for

  • 0

I am Using LINQ to query a table that has a foreign key for another table, I have run SQLMetal and generated the classes for the tables (as I am using SQL Compact Edition I don’t have much choice) and I am manually creating the columns for my grid view.

I have set the DataPropertyNames for each of the columns, and they work for the Properties of the parent objects, however I would like to populate a column with the value from one of the foreign tables (which in this case is called ‘issues’), I have tried setting the DataPropertyName to ‘issues.Title’ however this has no effect and the column remains empty.

If I loop over the Query result and print the value of ‘issues.Title’ they are present, however they still do not show up in the column. Does DataPropertyName not support sub objects like this or is it due to LINQ? I have tried setting up my query to use a join against the foreign keys too but I have the same result.

Edit:
I am aware that there is a ‘toString’ workaround that involves overiding the method on the nested object to return the value, however this isn’t applicable here since I’d like access to more than one property.

After some searching it’s parent that the DataGridView simply doesn’t support it, so I am looking for any other way of accessing a nested object’s property for use in the grid.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T14:27:09+00:00Added an answer on May 24, 2026 at 2:27 pm

    It looks like you’ll have to create delegating properties in your parent object like:

    public string IssueTitle
    {
        get { return issues.Title; }
    }
    

    Etc.

    Some even contend that this is the only proper way in terms of object oriented programming because it encapsulates child objects or referred objects in the parent object. Fact is, you can have the parent object itself decide what to render if e.g. there is no issues object.

    EDIT
    You may also consider using a view model.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple table and I can happily query it using LINQ
I have a DataGridView that I want to query using Linq (C# WinForm). I
I have a problem with the following Linq query using Entity Framework: from o
I have a linq query that is causing some timeout issues. Basically, I have
I have a table that looks like this: Id PageId Key Content LastUpdated ---------------------------------------------
I am using LINQ to query a generic dictionary and then use the result
Using LINQ to Entities sounds like a great way to query against a database
Can LINQ to SQL query using NOT IN ? e.g., SELECT au_lname, state FROM
Using LINQ to SQL, I have an Order class with a collection of OrderDetails.
When using Linq to SQL and stored procedures, the class generated to describe the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.