Yeah I know the title sounds funny. It is, but like kids they are going to make me crazy.
Ok here is the stiuation. I need to get the transactiontableid datavalue if it is changed (band 2) then the elementid displaytext (band 1?) and the AllocatorID (band 2 child 1?) and then change the value list in RuleName (band 2 child 1 child 1?). The valuelist for RuleName would also be changed for all allocatordetail childs in such manner. I have tried Parent, Selected row and nothing is working. Please help and thank you....
url for full image is http://www.kjmsolutions.com/images/gridconfusion.jpg
OK I get an index is outside the bounds of the array on the second row of the TransactionTableID still. I have reflected your changes in the code. The error occurs at AllocatorID assignment.
If e.Cell.Column.Key <> "TransactionTableID" Then
Exit Sub
End If
ElementID = e.Cell.Row.ParentRow.Cells(0).Value
trantableid = e.Cell.Value ' Since this is what we're checking to see if it changed at the beginning
allocatorid = e.Cell.Row.ChildBands(0).Rows(0).Cells("AllocatorID").Value 'Error index outside of array
'ElementID = dgElements.Rows(dgElements.ActiveRow.GetChild(0).Index).Cells(0).Value
' trantableid = dgElements.ActiveRow.Cells("TransactionTableID").Value
'Debug.WriteLine(dgElements.ActiveRow.ChildBands(1).Rows.Count - 1)
'allocatorid = dgElements.ActiveRow.ChildBands(dgElements.ActiveRow.GetChild(0).Index).Rows(0).Cells("AllocatorID").Value
"slfunction"
RulesList.ValueListItems.Clear()
Dim i As Integer
RulesList.ValueListItems.Add(dt.Rows(i).Item("RuleID"), dt.Rows(i).Item("RuleName"))
Next
For i = 0 To e.Cell.Row.ChildBands(0).Rows(0).ChildBands.Count - 1 'dgElements.ActiveRow.ChildBands(0).Rows(0).ChildBands.Count - 1
Dim ii As Integer
dgElements.ActiveRow.ChildBands(0).Rows(0).ChildBands(i).Rows(ii).Cells("RuleName").ValueList = RulesList
End Sub
The problem here is that you're indexing directly into the Rows collection of the main grid, so you're always going to get a row off of the main band. I would think that you would have something like:
allocatorid = e.Cell.Row.ChildBands(0).Rows(0).Cells("AllocatorID").Value
While I think that the ActiveRow would still work, I think it's preferable to use the guaranteed reference to the cell/row that is provided to you via this method. If somehow the TransactionTableID cell gets changed without the row being active (i.e. in code), the code you've written will fail.
-Matt
Correction: It works on the first row where the transactionid is but on a second or third row. What am I missing?
How it stands now:
ElementID = dgElements.Rows(dgElements.ActiveRow.GetChild(0).Index).Cells(0).Value
trantableid = dgElements.ActiveRow.Cells("TransactionTableID").Value
Debug.WriteLine(dgElements.ActiveRow.ChildBands(0).Rows.Count - 1)
allocatorid = dgElements.ActiveRow.ChildBands(0).Rows(0).Cells("AllocatorID").Value
"sqlstatement"
It appears to have worked. I had a stoppoint in there i had forgot to take out. Thank you for your help.
Ok to change that value list for RuleName in all the rows of the allocator children this is what i have but nothing is happening:
Dim oBand As UltraGridBand
Dim oEditor As Infragistics.Win.EditorWithCombo
'dgElements.ActiveRow.ChildBands(0).Rows(0).Cells("AllocatorID").Value