# ActiveCellChanging

Learn the syntax and arguments for the ActiveCellChanging event available in Spread for ASP.NET.

## Content

Occurs when the active cell is changing from the current one to a new one (when the user clicks a new cell).

## Syntax

[Inline HTML]

```html
<ELEMENT ActiveCellChanging = "handler" ...>
```

[JavaScript]

```javascript
FpSpread1.addEventListener("ActiveCellChanging", handler, ...)
```

or

```javascript
FpSpread1.onActiveCellChanging = handler
```

## Arguments

***event.row***
Row index of new active cell
***event.col***
Column index of new active cell
***event.cancel***
Whether to cancel the operation
***event.spread***
Spread that raises the event

## Return Type

None

## Remarks

This event is triggered when the user changes from one cell to another. The event uses as arguments the indexes of the row and column of the new active cell.
If the cancel argument is set to true, the event is canceled and the active cell is not changed.

## Example

This example JavaScript code maps the event for the Spread on the client side.

```javascript
<script lang="javascript" type="text/javascript">
    window.onload = function () {
      var spread1 = document.getElementById("<%=FpSpread1.ClientID %>");
      if (document.all) {
        // IE
      if (spread1.addEventListener) {
      // IE9
      spread1.addEventListener("ActiveCellChanging", cellChanging, false);
      } else {
      // Other versions of IE and IE9 quirks mode (no doctype set)
      spread1.onActiveCellChanging = cellChanging;
      }
      }
      else {
      // Firefox
      spread1.addEventListener("ActiveCellChanging", cellChanging, false);
      }
      }
    
    function cellChanging(event) {
      var r = event.row;
      var c = event.col;
      if (r==1) event.cancel = true;
    }
</script>
```

## See Also

[ActiveCellChanged](/spreadnet/docs/latest/online-asp/overview/spweb-clientscriptref/clientscript-members/clientscript-allevents/CSSR-onActiveCellChanged)
[SetActiveCell](/spreadnet/docs/latest/online-asp/overview/spweb-clientscriptref/clientscript-members/clientscript-allmeths/CSSR-SetActiveCell)
[Scripting Members](/spreadnet/docs/latest/online-asp/overview/spweb-clientscriptref/clientscript-members)