AjaxCalendarExtender
AjaxCalendar is an ASP.NET AJAX extender that can be attached to any ASP:TextBox control to provide client-side date-picking functionality with customizable date-format and provide an UI in a popup control. You can interact with these calendar by selecting on a day to set the date, or ‘Today’ link to set the current date.
Some important properties of AjaxCalendarExtender:
- TargetControlID: The ASP:TextBox control ID where want to show calendar when user click on TextBox.
- DefaultView: Default view of the calendar when it first popup (Days, Months or Years).
- PopupPosition: It indicate where you want the calendar displayed (bottom, left, top or right).
- StartDate: Minimum date that user can select.
- EndDate: Maximum date that user can select.
- SelectedDate: Date to be initially filled in TextBox.
Aspx Page coding:
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
-
- <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title></title>
- </head>
- <body>
- <form id="form1" runat="server">
- <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
- </asp:ToolkitScriptManager>
- <div>
- <asp:CalendarExtender ID="CalendarExtender1" runat="server"
- TargetControlID="txtDate" PopupPosition="Right" EndDate="8/10/2015"
- StartDate="2012-03-03" TodaysDateFormat="d MMMM, yyyy"
- SelectedDate="8/10/2015">
- </asp:CalendarExtender>
- <asp:TextBox runat="server" ReadOnly="true" ID="txtDate">
- </asp:TextBox>
- </div>
- </form>
- </body>
- </html>
Output
Note: You need to use the Ajax Control Toolkit library.