Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
385
UltraGrid Datarelation Issue
posted

Hello All,

I'm a bit of a newbie with Ultragrids(though am very happy with them so far) so I apologize in advance if this is an obvious question....

I am using an UltraGrid to display, update and add information from a database.  The user has requested the info be displayed in 2 bands(parent/child).  I am displaying the info correctly but am unable to modify any of the settings on the second band (like titles, add filters or add valuelists for combo boxes).  I'm assuming it is an issue with the way I have written the code for the actual datarelation:

<code> 

Dim MainDataTable As New DataTable()

Dim SecondDataTable As New DataTable()

Dim c_dataSet_MaterialsMain = New DataSet()

Dim MainTableAdapt As New SqlDataAdapter(vw_materialsmain1, CONNSTRING)

Dim SecondTableAdapt As New SqlDataAdapter(vw_materialsmain2, CONNSTRING)

Dim MainTable As New DataTable("MainMaterials")Dim SecondaryTable As New DataTable("Secondary")

MainTableAdapt.Fill(MainTable)

SecondTableAdapt.Fill(SecondDataTable)

UltraGrid1.DataSource = MainTable

c_dataSet_MaterialsMain.Tables.Add(MainTable)

c_dataSet_MaterialsMain.Tables.Add(SecondDataTable)

Dim SecondaryMaterials As New DataRelation("SecondaryMaterials" _

, MainTable.Columns("materialNumber") _

, SecondDataTable.Columns("materialNumber"))

c_dataSet_MaterialsMain.Relations.Add(SecondaryMaterials)

</code>

Then, this is the code I use to initialize the layout for the grid:

 

<code>

Private Sub UltraGrid1_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayoutDim band As UltraGridBand = Me.UltraGrid1.DisplayLayout.Bands(0)

 

Call InitializeSubType()

Call InitializeCategory()

Call InitializeVendorName()

Call InitializeMatStatus()

Call InitializeMatType()

Call InitializeComponents()Call InitializeSeasons()

band.Override.AllowRowFiltering = DefaultableBoolean.True

 

band.Override.FilteredInRowAppearance.BackColor = Color.IndianRed

band.Override.FilterClearButtonLocation = FilterClearButtonLocation.Cell

End Sub

</code>

This all works great for the parent grid but I'm not having much success with the child band.  My teammate suggested using:

Dim band2 As UltraGridBand = Me.UltraGrid1.DisplayLayout.Bands(1)

 

but that isn't working and am getting an error when trying to run.

Any help you can provide is much appreciated!

Julie