Thursday, 7 October 2010

Janus GridEx - Adding a button Column

When using a Janus GridEx control it can be useful to have a column with a button in it.

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

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


'put handling code here
        End If

    End Sub


Anonymous said...


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.

Rahman Mahmoodi said...


I have to say thank you very much. As it was of a great help and saved me time!!