In this article I will explain with an example, how to set specific Date Format such as dd/MM/yyyy for the ASP.Net AJAX Control Toolkit CalendarExtender control.
Download and Install AJAX Control Toolkit
In order to download and install AJAX Control Toolkit, please refer the following article.
Register AJAX Control Toolkit
You will need to register the AJAX Control Toolkit assembly in order to use the AJAX Control Toolkit’s controls.
You need to place the following line just below the @Page directive.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
HTML Markup
The HTML Markup consists of following controls.
ScriptManager – For enabling ASP.Net
AJAX.
TextBox – For displaying selected date.
ImageButton – For displaying calendar image icon.
CalendarExtender – For capturing date.
The
AJAX CalendarExtender has been set assigned with the following properties:
PopupButtonID – For showing Popup.
TargetControlID – The control where the text will be displayed.
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:TextBox ID="txtDate" runat="server" ReadOnly="true" />
<asp:ImageButton ID="imgPopup" runat="server" ImageUrl="~/Image/calendar.gif" />
<asp:CalendarExtender ID="Calendar1" runat="server" TargetControlID="txtDate" PopupButtonID="imgPopup" />
Screenshot
Demo
Downloads