I am trying to setup a grid with several dropdown grid and then determine in the CurrentCellDropDown event which drop down grid was selected and then determine the selections made by the user (they have a checkbox in the first column for the user to select which one(s) they want). I can determine the selections once I know the grid that was dropped down but I can't seem to figure out which dropdown is currently enabled. I have used the DropDownGrid sample as my guide. My code looks some like this so far:
Dim GridA as GridControl
Dim GridB as GridControl
Dim GridC as GridControl
'setup each drop grid
GridA = New GridControl()
GridA.Cols.Hidden.Item(0) = True
GridA.ThemesEnabled = True
GridA.CausesValidation = False
'routine to populate the grid with coded information
Dim aModel as New DropDownGridCellModel(Me.GridControl3.Model)
aModel.EmbeddedGrid = GridA
'similar routines for all the rest of the grids
'finally add the grid to a cell
GridControl3(2,1).Text = "Task"
GridControl3(2,1).CellType = "GridADropCell"
GridControl3(3,1).Text = "Formulation"
GridControl3(3,1).CellType = "GridBDropCell"
So what I am after is when the user clicks the drop arrow (to close the drop grid) I would like to be able to get the grid that was associated with and then get my selections (in the CurrentCellDropDown event). I am close but am missing one or two key points to getting this totally done.
Thank you all very much.
David A. Gonzales
ADAdministrator Syncfusion Team August 13, 2003 07:29 AM
In the CurrentCellShowingDropDown (or CurrentCellShowedDropDown), you can get the current cell of the parent grid, and from it, get the row and column of the parent grid. Once you have the row and column, is that enough for you to know the dropped grid that is being used?
Dim cc as GridCurrentCell = Me.parentGrid.CurrentCell
'now cc.RowIndex and cc.ColIndex have teh row and column
DGDavid GonzalesAugust 13, 2003 10:25 AM
Boy that was easy! I guess I try and make things harder than they are. Thanks for the info!
DGDavid GonzalesAugust 14, 2003 06:32 AM
After the help you gave me I came up with an easy way to determine which sub-grid the user has selected. While many people already now how to do this I am posting it for all the newbie's (like myself) out there.
Private Sub GridControl3_CurrentCellCloseDropDown(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.PopupClosedEventArgs) Handles GridControl3.CurrentCellCloseDropDown
Dim cc As GridCurrentCell = GridControl3.CurrentCell
Dim myGrid As GridControl
Dim strTmp As String
Dim nRow = cc.Renderer.CurrentCell.RowIndex
Dim nCol = cc.Renderer.CurrentCell.ColIndex
Dim mySubGrid As GridControl
Dim myDropDownModel As DropDownGridCellModel
myDropDownModel = GridControl3.CellModels(GridControl3(nRow, nCol).CellType.ToString())
mySubGrid = myDropDownModel.EmbeddedGrid
strTmp = ""
If Not (mySubGrid Is Nothing) Then
strTmp = GetGridItems(mySubGrid)
At the end of the call the list of items selected is in the strTmp string (which I use later).
Hope this helps others out there.