Skip to content

<CalendarImage>

The CalendarImage tag renders a clickable image that opens a pop-up date-picker. When the user picks a date, it's written into the target control (typically a <TextBox>) — same behavior as <CalendarButton>, just rendered as an image (a small calendar icon is the usual choice).

Validation is skipped

CalendarImage sets CausesValidation="False" automatically, so opening the calendar won't trigger client-side validation on the form.

Example

html
<AddForm>
  <SubmitCommand CommandText="INSERT INTO Events(EvtDate) VALUES(@EvtDate)" />
  <table>
    <tr>
      <td>
        <Label For="txtEventDate" Text="Event Date" />
        <TextBox Id="txtEventDate" DataField="EvtDate" DataType="datetime" />
        <CalendarImage AlternateText="Select Date" ImageUrl="~/images/calendar.gif"
                       Target="txtEventDate" Format="yyyy-MM-dd" />
       </td>
    </tr>
    <tr>
      <td colspan="2"><AddButton Text="Add" /> <CancelButton Text="Cancel" /></td>
    </tr>
  </table>
</AddForm>

Properties

PropertyValuesDefaultDescription
Target *control IDID of the control (typically a <TextBox>) that will receive the selected date
ImageUrlURLPath to the image file to display
AccessKeystringKeyboard shortcut character (e.g. F for Alt+F)
AlternateTextstringAlt text for accessibility (screen readers) and search engines
CssClassstringCSS class name(s) for styling the control
EnabledTrue FalseTrueWhen False, the control is disabled (grayed out and not interactive)
Formatdate format stringFormat string used when writing the selected date into the target. If omitted, the server's short date format is used
HeightsizeHeight of the image
IDstringUnique identifier for the control within the form
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 image

* Required property

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

  • Target: The ID of the form control that will receive the selected date — typically a <TextBox>. The control must be in the same form as the calendar trigger.

  • Format: A .NET date format string used to write the selected date into the target control. If omitted, the server's short date format is used. Common patterns: yyyy-MM-dd (ISO date), MM/dd/yyyy (US), dd/MM/yyyy (UK). If you need to enforce that format on submission, pair the target textbox with a <Validate Type="regex"> rule.