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 6884303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:29:26+00:00 2026-05-27T05:29:26+00:00

let’s have these classes: public class MyObject { //constructor and other stuff public bool

  • 0

let’s have these classes:

public class MyObject
{
  //constructor and other stuff
  public bool MyBool { get; set; }
  public string MyString { get; set; }
  public double MyDouble { get; set; }
  ...
  public List<MyProperty> Properties { get; set; }
}

public class MyProperty
{
  //constructor and other stuff
  public Type TheType { get; set; }
  public String Name { get; set; }
  public Object Value { get; set; }
}

In the form I will populate the values:

MyObject myObject = new MyObject(true, "Foo", 12);
MyObject myObject2 = new MyObject(false, "Bar", 16);

myObject.Properties.Add(new MyProperty(typeof(double),"Amount",2000));
myObject.Properties.Add(new MyProperty(typeof(string),"Name","Ale"));

//in the same order, with the same type and name
//only the values are different
myObject2.Properties.Add(new MyProperty(typeof(double),"Amount",3000));
myObject2.Properties.Add(new MyProperty(typeof(string),"Name","Teru"));

List<MyObject> list = new List<MyObject>();

list.Add(myObject);
list.Add(myObject2);

Now, the question is: how can I display the fixed fields and the dynamic defined properties in a single datagridview?
The final result should be something like:

MyBool | MyString | MyDouble | Amount | Name
true   |  Foo     |   12     |  2000  | Ale
false  |  Bar     |   16     |  3000  | Teru

Any ideas or hints are 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-05-27T05:29:27+00:00Added an answer on May 27, 2026 at 5:29 am

    The only way that we have ever been able to do this is using a third party grid control that allows us to define columns at run time and populate the values in these columns on a row-by-row basis. I haven’t tried this with a standard grid, but hopefully the same principle applies.

    Basically, the process at runtime is:

    1) Add the standard columns using the fixed properties and databind them to the underlying property.

    2) Add the columns necessary to display the dynamic properties, but don’t databind them.

    3) On display, for each row, move the content from the underlying record into the row.

    4) On save, for each row, move the content from the row back into the record.

    Although this sounds like a lot of work, once you have it figured out, it it pretty easy.

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

Sidebar

Related Questions

Let's say that I have classes like this: public class Parent { public int
Let's imagine I have a Java class of the type: public class MyClass {
Let's say you have a class called Customer, which contains the following fields: UserName
Let's say I have some content classes like Page, TabGroup, Tab, etc. Certain of
Let's say on a page I have alot of this repeated: <div class=entry> <h4>Magic:</h4>
Let's say that I have a set of relations that looks like this: relations
Let's say I have a simple UserControl with no codebehind: <UserControl xmlns= .... x:Class=TrafficLight.LightControl>
Let's say I have the following models class Photo(models.Model): tags = models.ManyToManyField(Tag) class Tag(models.Model):
Let's say I'm building a data access layer for an application. Typically I have
Let me try to explain what I need. I have a server that is

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.