For each dc as C1.Win.C1TrueDBGrid.C1DataColumn in Me.C1TrueDBGrid1.Columns
Dim c As C1.Win.C1TrueDBGrid.C1TrueDBDropdown
c = New C1.Win.C1TrueDBGrid.C1TrueDBDropdown
CType(c, System.ComponentModel.ISupportInitialize).BeginInit()
' c
c.AllowColMove = True
c.AllowColSelect = True
c.AllowRowSizing = C1.Win.C1TrueDBGrid.RowSizingEnum.AllRows
c.AlternatingRows = False
c.ColumnCaptionHeight = 20
c.ColumnFooterHeight = 20
c.DataSource = Me.C1TrueDBGrid1.DataSource
c.DataMember = Me.C1TrueDBGrid1.Columns(c).DataField
c.ExtendRightColumn = True
c.FetchRowStyles = False
c.Location = New System.Drawing.Point(208, 112)
c.Name = "ddwn" & c
c.RowDivider.Color = System.Drawing.Color.DarkGray
c.RowDivider.Style = C1.Win.C1TrueDBGrid.LineStyleEnum.[Single]
c.RowSubDividerColor = System.Drawing.Color.DarkGray
c.ScrollTips = False
c.Size = New System.Drawing.Size(100, 88)
c.TabIndex = 1
c.Text = "ddwn" & c
c.Visible = False
Me.C1TrueDBGrid1.Controls.Add(c)
CType(c, System.ComponentModel.ISupportInitialize).EndInit()
With Me.C1TrueDBGrid1.Columns(c)
.DropDown = c
.FilterDropdown = True
End With
' turn on the dropdown button in the filterbar
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(c).FilterButton = True
' turn it off for regulars cells in the grid
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(c).Button = False
c.ColumnHeaders = False
Next
Now when you assign a DataSource to your grid, you will automatically get Excel Style filters on your True DBGrid.
Hope this helps someone.
1 comment:
Do you have more code using the C1trueDBGrid?
I would like to see how to bind it to a dataset and set columns in code. Also how to update the data back to the source DataBase.
Thanks.
Post a Comment