---
title: CMSEditModeButtonEditDelete
related:
  - https://docs.kentico.com/k9/managing-website-content/configuring-the-environment-for-content-editors/enabling-on-site-editing.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

The CMSEditModeButtonEditDelete control displays a pair of buttons that allow content editors to edit or delete pages. The buttons only appear in the **Edit** mode of the **Pages** application and in [On-site editing mode](https://docs.kentico.com/k9/managing-website-content/configuring-the-environment-for-content-editors/enabling-on-site-editing.md).

> **Tip:** **Tip**: Many CMS listing controls (and web parts), such as the [CMSRepeater](https://docs.kentico.com/k9/references/kentico-controls/cms-controls/cms-controls-listings-and-viewers/cmsrepeater.md) (Repeater), have the **ShowEditDeleteButtons** (**Show Edit and Delete buttons**) property, which automatically adds the CMSEditModeButtonEditDelete control next to every displayed page. The system automatically sets the Path of these controls to match the displayed page.

## Getting started

The following tutorial shows how to display a pair of buttons that edit or delete a specific news page:

1. Create a new [ASPX page template](https://docs.kentico.com/k9/developing-websites/developing-websites-using-aspx-templates/creating-aspx-page-templates.md).
2. In Visual Studio, drag the **CMSEditModeButtonEditDelete** control from the toolbox onto the page template's form.
3. Set the **Path** property of the control to: _/News/New-Consulting-Services_

   ```html

   <cms:CMSEditModeButtonEditDelete ID="CMSEditModeButtonEditDelete1" runat="server" Path="/News/New-Consulting-Services" />

   ```
4. Switch to the template's code behind and add the following references:

   ```csharp

   using CMS.PortalEngine;
   using CMS.Helpers;
   using CMS.Controls;

   ```
5. Add the following code to the **Page\_Load** method:

   ```csharp

   // Registers the edit mode button script
   if (!PortalContext.ViewMode.IsLiveSite())
   {
       ScriptHelper.RegisterClientScriptBlock(this, typeof(string), ScriptHelper.EDIT_DOCUMENT_SCRIPT_KEY, CMSControlsHelper.EditDocumentScript);  
   }

   ```

   > **Info:** The code above is required if you wish to use the control individually on an ASPX page template.
6. Create a page based on the template in the Kentico administration interface.

If  you view the page in the **Edit** mode of the **Pages** application, the control displays a pair of buttons:

![](https://docs.kentico.com/docsassets/k9/cmseditmodebuttoneditdelete/CMSEditModeButtonEditDelete.png)

If you click the **Edit** button, the control redirects you to the editing form of the _/News/New-Consulting-Services_ page. If you click **Delete**, the system deletes the given page.

## Adding the control to transformations

You can add the CMSEditModeButtonEditDelete control into the code of ASCX [transformations](https://docs.kentico.com/k9/developing-websites/loading-and-displaying-data-on-websites/writing-transformations.md) or Item templates.

```html

<cms:CMSEditModeButtonEditDelete runat="server" id="btnEditDelete" Path='<%# Eval("NodeAliasPath") %>' />

```

Alternatively, you can add the default version of the control to transformations through the following expression:

```text

##editbuttons##
```

## Configuration

You can set the following properties for the CMSEditModeButtonEditDelete control:

| Property name | Description                                                                                                                                                       | Sample value                 |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
| DeleteText    | Sets the caption of the delete button. If not set, the default text is "Delete".                                                                                  | "Delete article"             |
| EditMode      | Determines which buttons the control displays. Possible options are both, just the Edit button, or just the Delete button. By default, both buttons are included. | "Both"<br>"Edit"<br>"Delete" |
| EditText      | Sets the caption of the edit button. If not set, the default text is "Edit".                                                                                      | "Edit article"               |
| Path          | Path of the page that the control edits/deletes.                                                                                                                  | "/whitepapers/myfirstpaper"  |

## Appearance and styling

The appearance of the CMSEditModeButtonEditDelete control is determined by the following CSS classes:

| CSS class name          | Applies to                    |
| ----------------------- | ----------------------------- |
| CMSEditModeButtonEdit   | The edit button's  element.   |
| CMSEditModeButtonDelete | The delete button's  element. |

The recommended place to define these classes is in a Kentico [stylesheet](https://docs.kentico.com/k9/developing-websites/designing-websites-using-css.md) using the **CSS stylesheets** application.

You can apply stylesheets to:

- Entire websites
- Individual pages that contain the control
