Search code examples
genexus

Genexus: selected rows


I'm working with a grid that allows selection. I have a variable whose Control Type is Check Box.

I want to enable a button if at least one row is selected, otherwise the button should be disable.

To achieve this I'm using the event "Click" of the CheckBox variable.

How can I get the number of selected rows? Thanks in advance.

Environment: (C# Web) GeneXus X Evolution 2 Version: 10.2.54798


Solution

  • Try this:

    Event Refresh
        &count = 0
    EndEvent
    
    Event Checkbox.Click
        if Checkbox = true
            &count += 1
        else
            &count -= 1
        endif
        if &count > 0
            Button.enabled = 1
        else
            Button.enabled = 0
        endif
    EndEvent
    

    In this sample &count has the number of selected rows.