C# : Tutorial of Asp.net with c# and example

Example and code about windows application, web application, SQL, C#, WPF etc which is helpful to developer and programer.

Search This Blog

ASP.Net: How to use ajax calender extender control with demo code in C#

♠ Posted by uvesh master in

ASP.NET AJAX Calender Extender use for the get selected date in particular control like textbox,Image button or button.

Step 1: First of all you need download ajax control toolkit from http://ajaxcontroltoolkit.codeplex.com/ and add in your project Bin Folder by right click on Bin  Folder And select add reference.
then add following code in web.config file of asp.net project or website:
                <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagprifix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit"/>
You can add it on page like as follow:
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
Step 2: Add ToolScriptManager as follow:

<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">

Step 2:  Add One text box on your page as follow:
<asp:TextBox ID="txtDate" runat="server" ReadOnly="true"></asp:TextBox>
Step 3: Add One Image Button on your page as follow:

<asp:ImageButton ID="imgPopup" ImageUrl="images/calendar.png" ImageAlign="Bottom"
    runat="server" />
Step 4:  Now add Ajax calendarextender tag as follow:
<ajaxToolkit:CalendarExtender ID="Calendar1" PopupButtonID="imgPopup" runat="server" TargetControlID="txtDate"

OutPut As Follwo:

Improve Your Answer as comment below.
If our post is useful please share and comment on our post for more post and detail Visit :