How to sort a DataGrid bound to a DataRelation?
From: Kevin P. Fleming (kpfleming_at_backtobasicsmgmt.com)
Date: 05/05/04
- Next message: help: "HELP-Sorted Datagrids and modal dialogs"
- Previous message: Per Johansson: "Use Dataset from several forms"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 05 May 2004 07:21:57 -0700
I've got a strongly typed DataSet containing two tables with a
DataRelation defining the parent-child relationship between them. On my
form, there is a DropDownList ComboBox bound to the parent table,
allowing the user to select a row from that table.
Also I have a DataGrid bound to the DataRelation between the parent and
child tables (DataSource is set to the DataSet, DataMember is set to the
relation name). This works fine, as the user can use the ComboBox to
select a parent table row and the DataGrid properly displays the related
rows from the child table.
However, I cannot seem to find a way get the DataGrid to automatically
sort the child rows by their Name column. I can't use a DataView because
DataViews can't be bound to DataRelations. I have set the
DefaultView.Sort property of the child table, but that has no effect,
presumably because the DataGrid's internal DataView is not being built
directly from the child table, but from the DataRelation. I _can_
manually sort the rows in the grid, of course, but this is not very
elegant :-)
I even tried using the CurrencyManager returned from getting the
DataGrid's BindingContext, but the .List property for that
CurrencyManager is not a DataView, it's a DataViewManager, which doesn't
have a .Sort property.
Anyone have any ideas?
- Next message: help: "HELP-Sorted Datagrids and modal dialogs"
- Previous message: Per Johansson: "Use Dataset from several forms"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|