<xmod:DeleteButton>
<xmod:DeleteButton> renders a push-button that runs the parent template's <DeleteCommand> for the current row. The supplied <Parameter> tags fill the command's parameters so the right record gets deleted.
This tag is gated by the parent template's DeleteRoles. Place it inside <ItemTemplate> or <AlternatingItemTemplate> so each row has its own button. Always pair it with an OnClientClick confirmation prompt — once the SQL runs, the deletion is permanent.
Sibling variants
<xmod:DeleteImage>— same behavior, rendered as a clickable image<xmod:DeleteLink>— same behavior, rendered as a hyperlink
Example
<xmod:Template Id="Employees">
<ListDataSource CommandText="SELECT * FROM Employees" />
<DeleteCommand CommandText="DELETE FROM Employees WHERE EmployeeId = @EmpID">
<Parameter Name="EmployeeId" Alias="EmpID" />
</DeleteCommand>
<ItemTemplate>
<strong>[[FirstName]] [[LastName]]</strong>
<xmod:DeleteButton Text="Delete"
OnClientClick="return confirm('Are you sure you want to delete this employee?');">
<Parameter Name="EmployeeId" Alias="EmpID" Value="[[EmployeeId]]" DataType="Int32" />
</xmod:DeleteButton>
</ItemTemplate>
</xmod:Template>2
3
4
5
6
7
8
9
10
11
12
13
14
Properties
| Property | Values | Default | Description |
|---|---|---|---|
| ID | string | Unique identifier for the button | |
| Text | string | Caption displayed on the button | |
| Ajax | True False | False | When True, the delete runs via async postback (the row removes from the list without a full page refresh). Requires ID set (since v2.6) |
| CssClass | string | CSS class name(s) | |
| Style | string | Inline CSS | |
| Width | size | Width of the button | |
| Height | size | Height of the button | |
| ToolTip | string | Hover tooltip | |
| Visible | True False | True | Shows or hides the button |
| OnClientClick | JavaScript | Client-side script to run on click. Returning false cancels the delete — typically used for confirm() prompts | |
| AccessKey | string | Keyboard shortcut character | |
| Enabled | True False | True | When False, the button is disabled |
| TabIndex | integer | Tab order for keyboard navigation |
Deprecated Properties (styling)
| Property | Description |
|---|---|
| BackColor / BorderColor / BorderStyle / BorderWidth | Use CssClass or Style instead |
| Font-Bold / Font-Italic / Font-Names / Font-Overline / Font-Size / Font-Strikeout / Font-Underline | Use CssClass instead |
| ForeColor | Use CssClass or Style instead |
Child Tags
| Tag | Required | Description |
|---|---|---|
<Parameter> | required (one per <DeleteCommand> parameter) | Supplies the value for the matching <DeleteCommand> parameter |
<Parameter>
Use one <Parameter> for each @param in the parent template's <DeleteCommand>. The values are typically field tokens that identify the row.
| Attribute | Values | Default | Description |
|---|---|---|---|
| Name * | string | Parameter name on this control | |
| Alias | string | (same as Name) | Alternate parameter name used in the SQL — useful when the data column has a name that conflicts with another parameter |
| Value | string | token | Parameter value. Field tokens like [[ID]] are typical | |
| DataType | database type | String | Data type used when binding |
Property Details
Ajax: When
True, the delete is executed via async postback. The list re-renders without the deleted row and the rest of the page stays put. The button must have itsIDproperty set; the parent<xmod:Template>should also haveAjax="True".OnClientClick: A JavaScript expression run when the button is clicked, before the delete posts back. Returning
falsecancels the delete. The standard pattern is a confirm dialog:htmlOnClientClick="return confirm('Delete this record?');"1Without the
return, the dialog still appears but the user's choice is ignored — the delete will proceed regardless.