<CancelLink>
The CancelLink tag renders as a hyperlink at run-time. When clicked, the form closes without performing any server-side processing — same behavior as <CancelButton>, just rendered as an inline <a> element.
Validation is skipped
CancelLink sets CausesValidation="False" automatically, so any <Validate> controls on the form will not block the cancel action.
CancelLink works in both <AddForm> and <EditForm>.
Example
<AddForm>
...
<table>
<tr>
<td>
<Label For="txtFirstName" Text="First Name" />
<TextBox Id="txtFirstName" DataField="FirstName" DataType="string" />
</td>
</tr>
<tr>
<td>
<Label For="txtLastName" Text="Last Name" />
<TextBox Id="txtLastName" DataField="LastName" DataType="string" />
</td>
</tr>
<tr>
<td colspan="2"><AddLink Text="Add"/> <CancelLink Text="Cancel"/></td>
</tr>
</table>
</AddForm>Properties
| Property | Values | Default | Description |
|---|---|---|---|
| Text | string | Caption displayed as the link text | |
| AccessKey | string | Keyboard shortcut character (e.g. F for Alt+F) | |
| CssClass | string | CSS class name(s) for styling the control | |
| Enabled | True False | True | When False, the control is disabled (rendered as plain text, not a clickable link) |
| Height | size | Height of the control | |
| ID | string | Unique identifier for the control within the form | |
| OnClientClick | JavaScript | Client-side script to run when the link is clicked | |
| Redirect | URL | . | URL the user is redirected to after the cancel action | |
| RedirectMethod | Get Post | Get | HTTP method used for the redirect |
| Style | string | Inline CSS (e.g. color: red; border: solid 1px black;) | |
| TabIndex | integer | Tab order for keyboard navigation | |
| ToolTip | string | Text displayed on mouse hover | |
| Visible | True False | True | Shows or hides the control |
| Width | size | Width of the control |
Deprecated Properties
These properties use ASP.NET inline styling and are no longer recommended for modern web development. Use the CssClass property to apply CSS classes or the Style property for inline CSS instead.
| Property | Values | Description |
|---|---|---|
| BackColor | color name | #dddddd | Background color of the control |
| BorderColor | color name | #dddddd | Border color of the control |
| BorderStyle | NotSet None Dotted Dashed Solid Double Groove Ridge Inset Outset | Border style of the control |
| BorderWidth | size | Border width of the control |
| Font-Bold | True False | Bold text |
| Font-Italic | True False | Italic text |
| Font-Names | string | Font family name |
| Font-Overline | True False | Overline text decoration |
| Font-Size | XX-Small X-Small Small Medium Large X-Large XX-Large or size | Font size |
| Font-Strikeout | True False | Strikethrough text decoration |
| Font-Underline | True False | Underline text decoration |
| ForeColor | color name | #dddddd | Text color of the control |
Property Details
OnClientClick: A JavaScript expression to run when the link is clicked, before the server-side processing happens. Useful for confirmation dialogs (e.g.
return confirm('Discard changes?');). If your script returnsfalse, the link does nothing further.Redirect: After the cancel action, redirect the user to this URL. Field tokens may be used in the value (and are URL-encoded automatically), but function tokens like
[[Portal:ID]]and[[User:ID]]are not supported here. Use a single period (.) as a shortcut for "the current page".RedirectMethod: The HTTP method used for the redirect.
Get(the default) appends form values as query string parameters.Postsubmits them as a form POST.Post uses ID, not DataField
When
RedirectMethod="Post", the field names in the posted form come from each form control'sID, not itsDataField.