Skip to content

<xmod:AjaxImage>

<xmod:AjaxImage> renders a clickable image that fires an AJAX request when clicked — same behavior as <xmod:AjaxButton>, just rendered as an image rather than a push-button.

Requires jQuery

The hosting page must include jQuery.

Sibling variants

Example

html
<xmod:Template Id="Employees">
  <ListDataSource CommandText="SELECT * FROM Employees" />
  <ItemTemplate>
    <strong>[[FirstName]] [[LastName]]</strong>
    <xmod:AjaxImage AlternateText="Get Employee History" ImageUrl="~/images/info.gif"
        Url='[[Join("~/GetEmployeeHistory.aspx?empid={0}",[[EmployeeId]])]]'
        Target="#EmployeeHistory" />
  </ItemTemplate>
</xmod:Template>

<div id="EmployeeHistory"></div>

Properties

PropertyValuesDefaultDescription
Url *URLThe URL to fetch via AJAX
TargetjQuery selectorThe element whose content is replaced by the response. Required unless OnSuccess is set
ImageUrlURLPath to the image file. Tilde (~) supported
AlternateTextstringAlt text for screen readers and search engines
LoadingImageUrlURLImage shown while the AJAX call is in flight
LoadingCssClassstringCSS class applied to the loading image
OnSuccessJS function nameJavaScript function called with response data instead of replacing Target
OnErrorJS function nameJavaScript function called on AJAX failure
Methodget postgetHTTP method used for the request
CssClassstringCSS class name(s)
StylestringInline CSS
ToolTipstringHover tooltip
VisibleTrue FalseTrueShows or hides the control

* Required property

Deprecated Properties (styling)

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

See <xmod:AjaxButton> for full property details.