Parent Child (Master detail) relationship dataset RRS feed

  • Question

  • Dear All,

      In ADO.NET, the parent and child datatables loads all the records in to memory. Is there any way to just load the associated records in the child datatable? Any method to do so?

    Sunday, June 1, 2008 11:37 AM

All replies


    If you mean a datatable with "ID" column and "ParentID" column, you could load it on demand.

    1. Load all the records where "ParentID IS NULL" OR "ParentID < 0". These are top level records.

    2. When the user select one one the top level records, load all the records where "ParentID = @ID". @ID is the one selected by the user.



    Monday, June 2, 2008 6:02 AM

    In what event to just fetch the associated child (detail) records from the database instead of loading all data?


    Monday, June 2, 2008 1:30 PM
  • If you are using TreeView Control. To populate the TreeNode object with data on demand, set the PopulateOnDemand property of a node to true, and create a TreeNodePopulate event handler to populate the TreeNode object with data.

    For more information, you could visit


    Tuesday, June 3, 2008 6:46 AM
  • Have you solved the problem or anything else I can do for you?

    Thursday, June 5, 2008 7:25 AM
  • Sometimes Gridview is used instead. And there are chances a listbox is used. Also I think the event is not on Grid or Treeview.


    Actually, I am still working on to find the events to reload the detail (Child) records programmatically. I am investigating using bindingsource.


    Moreover, I am also searching for effective and elegant way to enable the save button.

    Friday, June 6, 2008 1:25 AM