# Javascript: HeaderFooter.setConnectedToPrevious Method

> Sets a value specifying whether the header or footer is connected with the header or footer of the previous section. If headers or footers are connected, they have always the same contents.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: HeaderFooter.setConnectedToPrevious Method
- **437 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/headerfooter/setconnectedtoprevious-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/headerfooter/setconnectedtoprevious-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/headerfooter/setconnectedtoprevious-method/llms-full.txt

---

### Description

Sets a value specifying whether the header or footer is connected with the header or footer of the previous section. If headers or footers are connected, they have always the same contents.

### Syntax

```javascript
<void> HeaderFooter.setConnectedToPrevious(<boolean> connectedToPrevious, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| connectedToPrevious | Specifies whether the header or footer is connected with the header or footer of the previous section. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `HeaderFooter.setConnectedToPrevious` in a practical document-editing workflow. It sets a value specifying whether the header or footer is connected with the header or footer of the previous section. If headers or footers are connected, they have always the same contents.

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function configureConnectedToPrevious(headerFooter) {
    headerFooter.setConnectedToPrevious(
        true,
        function() {
            console.log("set connected to previous completed.");
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: HeaderFooter.pageNumberFields Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/headerfooter/pagenumberfields-property/llms-full.txt)
- **Next:** [Javascript: HeaderFooter.setDistance Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/headerfooter/setdistance-method/llms-full.txt)
