We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridListControl Hiding Columns

I am using a CellType of GridListControl with the following code: gcSection(intLoop, partColumn.PartNumber).CellType = "GridListControl" gcSection(intLoop, partColumn.PartNumber).DataSource = dvChildParts gcSection(intLoop, partColumn.PartNumber).DisplayMember = "PartNumber" gcSection(intLoop, partColumn.PartNumber).ValueMember = "ChildPartNumberID" gcSection(intLoop, partColumn.PartNumber).ExclusiveChoiceList = True gcSection(intLoop, partColumn.PartNumber).CellValue = strPartNumberID I need to hide certain colums of the datasource from showing to the users when the GridListControl is displayed. How do I hide the columns in the display GridListControl? I don't want to remove the columns from the datasource since I retrieve values later. Any information would be appreciated. Jeff

1 Reply

AD Administrator Syncfusion Team December 18, 2002 02:19 PM UTC

Jeff, Since the GridListControl that is displayed in the dropdown is generated every time the cell becomes active, you would need to handle this task dynamically. One way to do this is to use teh CurrentCellShowingDropDown event, and hide the column immediately before it is dropped. Here is code that would do this. You might want check explicitly row or column index values (cc.RowIndex or cc.ColIndex) to make sure you are on the proper cell.
Private Sub gridControl1_CurrentCellShowingDropDown(sender As Object, e As Syncfusion.Windows.Forms.Grid.GridCurrentCellShowingDropDownEventArgs)
    Dim cc As GridCurrentCell = Me.gridControl1.CurrentCell
    If TypeOf cc.Renderer Is GridDropDownGridListControlCellRenderer Then
        Dim grid As GridControl = CType(cc.Renderer, GridDropDownGridListControlCellRenderer).ListControlPart.Grid
        grid.Model.Cols.Hidden(1) = True
    End If
End Sub 'gridControl1_CurrentCellShowingDropDown

Live Chat Icon For mobile
Up arrow icon