Home › Forums › WinForms controls › Xceed Grid for WinForms › Can’t expand detail grid through code
-
AuthorPosts
-
#15483 |
I’ve created a master grid that contains a detail grid which contains a detail grid. Initially I have everything collapsed.
I have set up the main grid to use a button in the first column (Edit button) where the cursor moves to the desired column to be edited.
What I would like for it to do though is expand the detail grid and move the cursor to the desired detail cell to be edited.
My onclick event looks like this:
Me.GridControl.CurrentRow = Me.ParentRow
Me.GridControl.SelectedRows.Clear()
Me.GridControl.SelectedRows.Add(Me.ParentRow)
Me.ParentRow.BeginEdit()
If Me.ParentColumn.FieldName = “Edit” Then
Me.GridControl.CurrentColumn = Me.GridControl.Columns(“Credit”)
Me.GridControl.DetailGridTemplates(0).Expand()
End If
If Me.ParentColumn.FieldName = “EditLine” Then
Me.GridControl.DetailGridTemplates(0).DetailGridTemplates(0).Collapsed = False
End If
If Me.ParentColumn.FieldName = “EditResponse” ThenEnd If
Try
Me.GridControl.CurrentCell.EnterEdit()
Catch ex As ExceptionEnd Try
I can not get the detail grids to expand without using the mouse and clicking the “+” beside the row.
What am I missing?
ThanksImported from legacy forums. Posted by Greg (had 3393 views)
You are doing it on the template rather than on the actual detail grid. You need to access the detail grid of the master row and expand it.
e.g.:
CType( Me.ParentRow, Xceed.Grid.DataRow ).DetailGrids(0).Expand()
Imported from legacy forums. Posted by André (had 325 views)
Awesome!!! That did the trick. Thank you
Imported from legacy forums. Posted by Greg (had 342 views)
Since I have 3 SqlDataAdapters filling a single Dataset to produce the Master/Detail/Detail Grids…how can I push any changes back to the database after each change in any of the grids.
I’ve done a few things and it seems like sometimes it will save back to the database then the next time I try the same thing, it won’t.
I’m sure it has something to do with building a handler but I know nothing about doing that at this point.
Imported from legacy forums. Posted by Greg (had 371 views)
Normally, you need to call Update() on the adapters to update the DB from the DataSet, just as you call Fill() to fill the DataSet from the DB.
You can do this on any event you judge appropriate, for example when the user clicks on a save button, or on the Cell.ValueChanged event if you want to update the DB every time a value changes in a cell.
Imported from legacy forums. Posted by André (had 4404 views)
-
AuthorPosts
- You must be logged in to reply to this topic.