The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator Syncfusion Team 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";
}
DCdan carrAugust 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
ADAdministrator Syncfusion Team 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