Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
5491 | Jul 5,2003 02:15 AM UTC | Jul 5,2003 09:05 AM UTC | WinForms | 2 |
![]() |
Tags: GridControl |
//dSet is the DataSet being used... private void ListChildrenOfGridRow(int gridRowIndex) { GridBoundRecordState rs = this.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(gridRowIndex); if(rs.LevelIndex >= dSet.Relations.Count) { Console.WriteLine("--none"); } else { DataRelation relation1 = dSet.Relations[rs.LevelIndex]; string childColName = relation1.ChildColumns[0].ColumnName; string parentColName = relation1.ParentColumns[0].ColumnName; int parentPos = rs.Position; string parentValue = ((DataRowView)rs.Table[parentPos]).Row[parentColName].ToString(); string filter = string.Format("[{0}] = '{1}'", childColName, parentValue); DataView dv = new DataView(relation1.ChildTable, filter, "", DataViewRowState.CurrentRows); foreach(DataRowView drv in dv) { DataRow dr = drv.Row; Console.WriteLine("{0}, {1}, {2}", dr[0], dr[1], dr[2]); } dv.Dispose(); } }
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.
This page will automatically be redirected to the sign-in page in 10 seconds.