No, you subscribe to this event using AddHandler. Here are some snippets.
''hook the handler say in FormLoad
AddHandler Me.GridDataBoundGrid1.Model.QueryCellInfo, AddressOf GridQueryCellInfo
''also set the grid to refresh the whole row as the current cell changes Me.GridDataBoundGrid1.Model.Options.RefreshCurrentCellBehavior = GridRefreshCurrentCellBehavior.RefreshRow
Me.GridDataBoundGrid1.Model.Options.RefreshCurrentCellBehavior = GridRefreshCurrentCellBehavior.RefreshRow
''the handler
Private Sub GridQueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)
If e.ColIndex > 0 And e.RowIndex > 0 Then
Dim colorRow As Boolean = False
If e.ColIndex = 2 Then
colorRow = (e.Style.Text = "red")
Else
colorRow = (Me.GridDataBoundGrid1(e.RowIndex, 2).Text = "red")
End If
If colorRow Then
e.Style.BackColor = Color.Red
End If
End If
End Sub
Here is another way you could handle this requirement. Instead of handling QCI, you could handle CurrentCellShowingDropDown. There in this event, you populate the dropdownlist at that point. At that point you can dynamically set the datasource for the list that is about to be displayed.
Here is a sample