We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Master-child DataBoundGrids

Thread ID:





32649 Aug 4,2005 11:22 PM UTC Aug 5,2005 03:44 PM UTC WinForms 3
Tags: GridControl
dan carr
Asked On August 4, 2005 11:22 PM UTC

I have a dataset which contains 2 tables (A+B) which are joined. I set the data source of 2 datagrids to this dataset. Grid A has a data member of A. Grid B has a data member of B. Why isn''t there a ''parent''-''child'' relationship set up? i.e. I want to click on id 1 in grid A and ONLY records associated with id 1 appear in B. How can I set this up? Thanks, Dan

Administrator [Syncfusion]
Replied On August 4, 2005 11:43 PM UTC

You need to add the two datatables to a DataSet and then define a Relation between a column in the master datatable to a column in the detail table, and add this relation to the DataSet. This process is discussed in the GridDataBoundGrid Use Case section of the grid''s User''s Guide. Here is some code that is posted there. private void Form1_Load(object sender , System.EventArgs e) { //Fill the dataset with the two tables. this.sqlDataAdapter1.Fill(this.dataSet11.Customers); this.sqlDataAdapter2.Fill(this.dataSet11.Orders); //Add a DataRelation to the dataset. DataRelation dr = new DataRelation("CustomersToOrders", this.dataSet11.Customers.Columns["CustomerID"], this.dataSet11.Orders.Columns["CustomerID"]); this.dataSet11.Relations.Add(dr); //Set up the datasources. this.masterGrid.DataSource = this.dataSet11.Tables["Customers"]; this.detailsGrid.DataSource = Me.DataSet11.Tables["Customers"]; this.detailsGrid.DataMember = "CustomersToOrders"; }

dan carr
Replied On August 5, 2005 03:03 PM UTC

Thanks Clay. This worked. One other request: do you have an example which shows how to add records to parent/child grids. I can only find examples which show displaying info. Thanks, Dan

Administrator [Syncfusion]
Replied On August 5, 2005 03:44 PM UTC

Here is a forum thread that I think has a sample showing what you want. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=16124


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon