Skip to content

<xmod:CommandImage>

<xmod:CommandImage> renders a clickable image that fires one or more <Command> child tags — same behavior as <xmod:CommandButton>, just rendered as an image rather than a push-button.

Sibling variants

Example

html
<xmod:Template Id="Employees">
  <ListDataSource CommandText="SELECT * FROM Employees" />
  <ItemTemplate>
    <strong>[[FirstName]] [[LastName]]</strong>
    <xmod:CommandImage AlternateText="View Profile" ImageUrl="~/images/profile.gif">
      <Command Type="Detail" Target="EmployeeProfile">
        <Parameter Name="EmployeeId" Value="[[EmployeeId]]" />
      </Command>
    </xmod:CommandImage>
  </ItemTemplate>
</xmod:Template>

Properties

PropertyValuesDefaultDescription
IDstringUnique identifier for the image button
ImageUrlURLPath to the image file. Tilde (~) supported
AlternateTextstringAlt text for screen readers and search engines
ImageAlignNotSet Left Right Baseline Top Middle Bottom AbsBottom AbsMiddle TextTopNotSetImage alignment relative to surrounding content
AjaxTrue FalseFalseWhen True, the commands run via async postback. Requires ID set (since v2.6)
RedirectURL | .After the commands run, redirect the user to this URL
RedirectMethodGet PostGetHTTP method used for the redirect
CssClassstringCSS class name(s)
StylestringInline CSS
WidthsizeWidth of the image
HeightsizeHeight of the image
ToolTipstringHover tooltip
VisibleTrue FalseTrueShows or hides the control
OnClientClickJavaScriptClient-side script to run on click. Returning false cancels the action
AccessKeystringKeyboard shortcut character
EnabledTrue FalseTrueWhen False, the control is disabled
TabIndexintegerTab order for keyboard navigation
Deprecated Properties (styling)

BackColor, BorderColor, BorderStyle, BorderWidth, Font-*, ForeColor — use CssClass or Style instead.

Child Tags

Same as <xmod:CommandButton> — required <Command Target Type Name> tags with optional <Parameter> children.