Hello. Ive added to my ultragrid via code buttons. Each button in one column. Now i want to check when each button is clicked to do a specific action. Now i dont know what sort of method should i write to get individual button clicks. Here is my code of when i add the button and the code that i check for clicks. (The click method triggers with any button click, i want individual click detection)
Dim band As Infragistics.Win.UltraWinGrid.UltraGridBand = bossGrid.DisplayLayout.Bands(0)
band.Columns("BNAME").CellClickAction = CellClickAction.CellSelect band.Columns("FRAPPE").CellClickAction = CellClickAction.CellSelect band.Columns("COFFEE").CellClickAction = CellClickAction.CellSelect For i As Integer = 0 To bossGrid.Rows.Count - 1 bossGrid.Rows(i).Cells("FRAPPEPLUS").Value = _ "+" bossGrid.Rows(i).Cells("COFFEEPLUS").Value = _ "+" Next i For i As Integer = 0 To bossGrid.Rows.Count - 1 bossGrid.Rows(i).Cells("FRAPPEMINUS").Value = _ "-" bossGrid.Rows(i).Cells("COFFEEMINUS").Value = _ "-" Next i bossGrid.DisplayLayout.Bands(0).Columns("FRAPPEPLUS").Style = ColumnStyle.Button bossGrid.DisplayLayout.Bands(0).Columns("FRAPPEMINUS").Style = ColumnStyle.Button bossGrid.DisplayLayout.Bands(0).Columns("COFFEEPLUS").Style = ColumnStyle.Button bossGrid.DisplayLayout.Bands(0).Columns("COFFEEMINUS").Style = ColumnStyle.Button
bossGrid.DisplayLayout.Override.DefaultRowHeight = 20
Private Sub UltraGrid1_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.CellEventArgs) Handles bossGrid.ClickCellButton Dim frappePlus As UltraGridColumn = e.Cell.Band.Columns("FRAPPEPLUS")
If e.Cell.Band.Columns("FRAPPEPLUS"). = frappePlus Then (THE PROBLEM IS HERE. I NEED TO DETECT WHICH BUTTON IS PRESSED)
End If
MsgBox("FRAPPEPLUS") End Sub
Any ideas people?
Hi,
The button is not a control, so there's no way to hook an event on the button. You should use the ClickCellButton event of the grid. The event args give you the the cell that was clicked.
is it possible to give me an example?