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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:55:27+00:00 2026-05-20T23:55:27+00:00

I am currently designing a master detail gridview. I have two separate objects defined

  • 0

I am currently designing a master detail gridview. I have two separate objects defined for them. The parent gridview is binded to the first object and in row databind event I bind the second gridview with the detail object using parent ID.

A lot of examples I see on the internet initialize the details object inside the parent class,

public class Author
{

    private string name;
    public BooksList books=new BooksList();

    public BooksList Books
    {
       get
    { 
       return emailAddresses;
    }
    set
    {
       emailAddresses = value;
    }
}
  1. What is the purpose of initializing child class inside the
    parent class?

  2. Currently, I just bind the parent to a separate object & child to a
    separate object manually in my presentation layer & never initialize child objects inside parent class. Is that the wrong way
    for OOP ?

  3. What is the recommended way to achieve this task for my gridview?

Damien.

  • 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-20T23:55:28+00:00Added an answer on May 20, 2026 at 11:55 pm

    1: Most of the time you want to initialize you objects inside of your class to avoid null reference issues.

    2: You confusing you concepts here, as how you present your objects is not really relevant to OOP. The OOP part of the equation is all about what your classes are and how they relate to each other, so yes if there is a relationship between the parent and child classes, then it should be represented in the class structures.

    3: Ideally, you would have a class structure that allows you to bind to your datagrid and can automatically generate your hierarchy for your datagrid.

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

Sidebar

Related Questions

I currently have two interfaces(that I'll name here IA and IB ): interface IA
I'm currently designing a program that will involve some physics (nothing too fancy, a
I'm currently designing a brand new database. In school, we always learned to put
We are currently designing a website that will be accessed from kiosks in a
I'm currently designing a database for a project. Now I'm debating with myself whether
Currently I am designing a new website and I want to plan it properly.
Currently I am designing a website and I am finding it VERY difficult to
Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and
Currently we have a hybrid ASP/PHP setup connecting to a SQL Server 2005 database.
I'm currently creating an application for a customer that will allow them to automatically

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.