I am using UltraGrid of Infragistics 2005 with LLBLGen adapter. Using predefine data cloumn binding to select a specific column to show on grid by following code
With Northwind DB bind 3 columns from Customers table (CustomerID,CompanyName, Country)
...
Dim UltraGridBand1 As Infragistics.Win.UltraWinGrid.UltraGridBand = New Infragistics.Win.UltraWinGrid.UltraGridBand("Customers", -1)
Dim UltraGridColumn1 As Infragistics.Win.UltraWinGrid.UltraGridColumn = New Infragistics.Win.UltraWinGrid.UltraGridColumn("CustomerID")
Dim UltraGridColumn2 As Infragistics.Win.UltraWinGrid.UltraGridColumn = New Infragistics.Win.UltraWinGrid.UltraGridColumn("CompanyName")
Dim UltraGridColumn3 As Infragistics.Win.UltraWinGrid.UltraGridColumn = New Infragistics.Win.UltraWinGrid.UltraGridColumn("Country")
...
...
UltraGridColumn1.Header.VisiblePosition = 0
UltraGridColumn2.Header.VisiblePosition = 1
UltraGridColumn3.Header.VisiblePosition = 2
UltraGridBand1.Columns.AddRange(New Object() {UltraGridColumn1, UltraGridColumn2, UltraGridColumn3})
Me.UltraGrid1.DisplayLayout.BandsSerializer.Add(UltraGridBand1)
Me.UltraGrid1.DisplayLayout.MaxBandDepth = 1
...
Dim adapter As New DataAccessAdapter
Dim mCustomer As New EntityCollection(New CustomersEntityFactory)
adapter.FetchEntityCollection(mCustomer, Nothing)
'Me.UltraGrid1.DataSource = mCustomer
UltraGrid1.SetDataBinding(mCustomer, Nothing, True)
DataGrid1.DataSource = mCustomer
After finishing binding the UltraGrid the column CustomerID is hidden in UltraGrid.
I need to show this column. (CustomerID is primary key) but do not know to it.
I can access the column value, with this snippet I can see that CustomerID
...
Dim row As Infragistics.Win.UltraWinGrid.UltraGridRow
Dim id As String
row = UltraGrid1.ActiveRow
If Not row Is Nothing Then
id = row.Cells("CustomerID").Text()
MsgBox(id)
End If
...
Thanks.