AJAX ControlKit Tutorials AJAX CalendarExtender Control ASP.NET (C#)
AJAX ControlKit Tutorials AJAX CalenderExtender Control ASP.NET (C#)
You are asking yourself why an Ajax CalendarExtender Control. Well in a sense it just makes sense, you take these little awesome widgets & controls for granted because of the simplicity and ease of use. Chances are you if you have purchased air travel fare online in the past few years you have interacted with this Control yourself, and see how easy it was to use? Well this is a simple Ajax
Tutorial on how it works and how you can enable it in your Webform or Application.
The CalendarExtender is an ASP.NET AJAX control that is associated with a TextBox control. When the user clicks on the TextBox, a client-side Calendar control pops up. The user can then set a date by clicking on a day, navigate months by clicking on the left and right arrow and perform other such actions without a postback. If you want to popup a Calendar on the click of a button, you can use set the PopupButtonID of the CalendarExtender control to the ID of the button. The calendar extender can switch to year/decade view by clicking on the header. Clicking the first time brings up a list of months; clicking again brings up a list of years. The left and right arrow buttons also page through the months or years.
In this sample, you will learn how to use a CalendarExtender control in ASP.NET C#
· First Add New WebForm to this project and name it CalendarSample.aspx.
· Then Add a ScriptManager to the page.
· Also Add aTextbox control to the page
· Then Add a Calendarcontrol extender to the page. Set the target control
The markup of the page will look like
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CalendarSample.aspx.cs" Inherits="CalendarSample" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<form id="form1" runat="server">
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender1" TargetControlID="txtDate" runat="server">