ArcGIS Explorer Component Help |
TableBindingAdapter..::.GetRelatedBindingAdapter Method |
TableBindingAdapter Class Example See Also |
Gets the related binding adapter.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public TableBindingAdapter GetRelatedBindingAdapter( Row selectedRow, string relationshipName ) |
Visual Basic (Declaration) |
---|
Public Function GetRelatedBindingAdapter ( _ selectedRow As Row, _ relationshipName As String _ ) As TableBindingAdapter |
Parameters
- selectedRow
- Type: ESRI.ArcGISExplorer.Data..::.Row
A Row object which represents a single record in the Table.
- relationshipName
- Type: System..::.String
A TableRelationship object which represents an association between two tables based on a shared column and could be either a geodatabase relationship class or a in-memory TableRelationship.
Return Value
A TableBindingAdapter object which can be used to wrap either a Table or a RowCollection to make them act like a .NET bindable data source.Remarks
In order to use this method there must be a TableRelationship present between the two tables.
Examples
The code below illustrates how the GetRelatedBindingAdapter method could be used in a Windows Form
to display rows in a DataGridView control which are related to a row in another DataGridView control.
CopyC#
{ //Open the mountains fill geodatabase feature class Table mountains = Table.OpenFileGeodatabaseTable(@"C:\Data\Scotland.gdb", "mountains"); //Create a new TableBindingAdapter object for the mountains Table TableBindingAdapter tableAdapter = new TableBindingAdapter(mountains); //Fill the adapter with all the rows from the mountains Table tableAdapter.Fill(); //Set the UseCodedValueDomains property to display the descriptive name for the values in any //columns which have a CodedValueDomainDefined tableAdapter.UseCodedValueDomains = true; //Set the UseColumnAliasNames property to display alias names in the Column headers. tableAdapter.UseColumnAliasNames = true; //Note that the BindingSource component and the DataGridView control would normally be //instantiated by dragging and dropping them onto a Windows Form from the toolbox. //Create a new BindingSource component System.Windows.Forms.BindingSource bindingSource1 = new System.Windows.Forms.BindingSource(); //Set the DataSource to be the tableAdapter object bindingSource1.DataSource = tableAdapter; //Create a DataGridView control System.Windows.Forms.DataGridView dataGridView1 = new System.Windows.Forms.DataGridView(); //Set the Datasource to be the bindingSource1 object dataGridView1.DataSource = bindingSource1; }
CopyVB.NET
'Open the mountains file geodatabase feature class Dim mountainsTable As Table = Table.OpenFileGeodatabaseTable("C:\Data\Scotland.gdb", "mountains") 'Create a new TableBindingAdapter object for the mountains Table Dim tableAdapter As TableBindingAdapter = New TableBindingAdapter(mountainsTable) 'Set the UseCodedValueDomains property to display the descriptive name for the values in any 'columns which have a CodedValueDomainDefined tableAdapter.UseCodedValueDomains = True 'Set the UseColumnAliasNames property to display alias names in the Column headers. tableAdapter.UseColumnAliasNames = True 'Fill the adapter with all the rows from the mountains Table tableAdapter.Fill() 'Note that the BindingSource component and the DataGridView control would normally be 'instantiated by dragging and dropping them onto a Windows Form from the toolbox. 'Create a new BindingSource component Dim bindingSource1 As System.Windows.Forms.BindingSource = New System.Windows.Forms.BindingSource() 'Set the DataSource to be the tableAdapter object bindingSource1.DataSource = tableAdapter 'Create a DataGridView control Dim dataGridView1 As System.Windows.Forms.DataGridView = New System.Windows.Forms.DataGridView() 'Set the Datasource to be the bindingSource1 object dataGridView1.DataSource = bindingSource1