Skip to content

<AddButton>

The AddButton tag renders as a push-button at run-time. When clicked, it executes the <SubmitCommand> associated with the enclosing <AddForm>. Use <AddImage> for a clickable image button or <AddLink> for a hyperlink that performs the same action.

Use only inside AddForm

The AddButton triggers the <AddForm>'s <SubmitCommand>. It has no effect outside an <AddForm>.

Example

html
<AddForm>
  <SubmitCommand CommandText="INSERT INTO Users(FirstName, LastName)
                              VALUES(@FirstName, @LastName)" />
  <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"><AddButton Text="Add"/> <CancelButton Text="Cancel"/></td>
    </tr>
  </table>
</AddForm>

Properties

PropertyValuesDefaultDescription
TextstringCaption displayed on the button
AccessKeystringKeyboard shortcut character (e.g. F for Alt+F)
CssClassstringCSS class name(s) for styling the control
EnabledTrue FalseTrueWhen False, the control is disabled (grayed out and not interactive)
HeightsizeHeight of the control
IDstringUnique identifier for the control within the form
OnClientClickJavaScriptClient-side script to run when the button is clicked
RedirectURL | .URL the user is redirected to after the form processes the click
RedirectMethodGet PostGetHTTP method used for the redirect
StylestringInline CSS (e.g. color: red; border: solid 1px black;)
TabIndexintegerTab order for keyboard navigation
ToolTipstringText displayed on mouse hover
VisibleTrue FalseTrueShows or hides the control
WidthsizeWidth 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.

PropertyValuesDescription
BackColorcolor name | #ddddddBackground color of the control
BorderColorcolor name | #ddddddBorder color of the control
BorderStyleNotSet None Dotted Dashed Solid Double Groove Ridge Inset OutsetBorder style of the control
BorderWidthsizeBorder width of the control
Font-BoldTrue FalseBold text
Font-ItalicTrue FalseItalic text
Font-NamesstringFont family name
Font-OverlineTrue FalseOverline text decoration
Font-SizeXX-Small X-Small Small Medium Large X-Large XX-Large or sizeFont size
Font-StrikeoutTrue FalseStrikethrough text decoration
Font-UnderlineTrue FalseUnderline text decoration
ForeColorcolor name | #ddddddText color of the control

Property Details

  • OnClientClick: A JavaScript expression to run when the button is clicked, before the server-side processing happens. Useful for confirmation dialogs, client-side validation, or showing a busy indicator. If your script returns false, the button does nothing further (no postback, no submit). If it returns true (or doesn't return anything), the button proceeds normally.

  • Redirect: After the form's <SubmitCommand> runs, 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" — useful when you want to clear the form after a successful submit.

  • RedirectMethod: The HTTP method used for the redirect. Get (the default) appends form values as query string parameters. Post submits 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's ID, not its DataField. If your downstream page expects specific field names, set the IDs to match.