---
description: Checks if a row in a grid is selected or not.
---

# isRowSelected

## Parameters

1. controlId - The id of the grid
2. line - This can be either a whole line from a "myGrid.allRows" call or a single id from a record.

## Example Usages

```javascript
let result = app.isRowSelected("myGrid", myLine);
```

### Used in a loop

```javascript
let allRows = app.getFieldValue("myGrid.allRows");
for (let row of allRows) {
  if (app.isRowSelected("myGrid", row)) {
    console.log("This is selected: " + row.id);
  }
}
```

In this case, "allRows" is an array which contains the rows of "myGrid". We iterate through the array with the given for loop.

### Used with an id

```javascript
let result = app.isRowSelected("myGrid", 123); //Checks if the line with the id 123 is selected.
```

### Return Values

The function returns a boolean value, either true or false.
