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

  • SEARCH
  • Home
  • 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 8658199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:42:22+00:00 2026-06-12T15:42:22+00:00

Still new to LINQ2SQL so please forgive my ignorance … I have one user

  • 0

Still new to LINQ2SQL so please forgive my ignorance …

I have one user component which includes one Textbox and one button. The component is used as a generic ListOfValue Filter.
The component has one function to set a IQueryable which is passed to a form that is opened when the user clicks a button on the control.
The form consists of a grid (c1flexgrid) which is filled with the data from the IQueryable. There is a bindingsource on the form that gets the IQueryable as datasource.
The user can select inside the grid and after he selected an entry the dialog is closed and the selected row (or better the selected LINQ2SQL object from the row) is passed back to the control.
On this control i want to show one specific field out of that selected object. The name of that field is passed in to the user control as string.

My problem is, i don’t know how to get that field data from an “generic” LINQ2SQL object.
In debugger i can see, that the selected object is of a specific enity type (corresponding to the query)

Probably somthing similar to
Workaround for lack of 'nameof' operator in C# for type-safe databinding?
but just the opposit way 🙂

Any help would be very welcome

  • 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-06-12T15:42:23+00:00Added an answer on June 12, 2026 at 3:42 pm

    I’m assuming in your IQueryable you don’t know at design time the type T. If this is correct, you need to use reflection to get the value you want.

    var value = typeof(T).GetProperty("MyField").GetValue(instance, null);
    

    Alternatively, cast the instance to a common base type that implements your field.

    CommonBase castInstance = (CommonBase)instance;
    var value = castInstance.MyField;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi still new to Android and Java. Please have a look at this code,
I'm still new top rspec, so please excuse if this is an easy one
Im still new to C# and was wondering how one would have multiple things
Hey still new to JS/CSS/HTML well basicly webdevelopment. I have a page, for which
still new to XML parsing with the iphone so i have a few questions.
I'm still new to Core Data, so forgive the question. I'm building an app
I am still new to LINQ, and I have wrestled with a query for
Still new to the memory management in iPhone apps, I have a newbee question.
Still new to python and django, though learning ;-) I have a view that
I am still new to Python and have been reviewing the following code not

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.