This is an example of how to add a button column to a grid:
Dim ButtonCol As New Janus.Windows.GridEX.GridEXColumn
ButtonCol.Key = "Add" 'This is the way to identify the column when it is clicked
ButtonCol.ButtonText = "Add" 'the caption on the button
ButtonCol.ButtonDisplayMode = CellButtonDisplayMode.Always 'The button is visible even if the row is not selected
ButtonCol.ButtonStyle = ButtonStyle.ButtonCell
ButtonCol.Width = 40
GridEX1.RootTable.Columns.Add(ButtonCol)
And, how to respond to the button click event:
Private Sub GridEX1_ColumnButtonClick(ByVal sender As Object, ByVal e As Janus.Windows.GridEX.ColumnActionEventArgs) Handles GridEX1.ColumnButtonClick
If e.Column.Key = "Add" Then 'Add should be replaced with the key to the button column
'To pick up the value of a specific cell in the current row, for example to get the record ID
CInt(GridEX1.GetRow(GridEX1.Row).Cells("Id").Text)
'put handling code here
End If
End Sub
2 comments:
Hi,
I want to ask "how to control enable/disable" that buttoncell from FormattingRow event?"
for example, in my gird, i have a condition to show button cell in certain row only. so i have to disable that buttoncell in other rows.
Thanks in advance.
Hi,
I have to say thank you very much. As it was of a great help and saved me time!!
Post a Comment