# Locking a Column

Learn how you can lock a column on the client-side using code. Learn more in documentation.

## Content



You can use the [SetLocked](/spreadnet/docs/latest/online-asp/overview/spweb-clientscriptref/clientscript-members/clientscript-allmeths/CSSR-SetLocked) method to lock a column on the client side.

You can also use attributes to lock a column. The following code locks and unlocks column 1 on the client side.

```javascript
<script language="javascript">
  function unlockCol() {
    var span = FpSpread1.all("FpSpread1_view");
    var table = span.firstChild;
    var tr;
    for (var j = 1;j<=FpSpread1.GetRowCount();j++) {
      tr = table.rows(j);
      tc = tr.cells(1);
      tc.removeAttribute("FpCellType");
    }
  }

  function lockCol() {
    var span = FpSpread1.all("FpSpread1_view");
    var table = span.firstChild;
    var tr;
    for (var j = 1;j<=FpSpread1.GetRowCount();j++) {
      tr= table.rows(j);
      tc = tr.cells(1)
      tc.setAttribute("FpCellType","readonly");
    }
  }
</script>
```