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 in at Sunday, September 21, 2014

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:
<pages>
      <controls>
                <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagprifix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit"/>
      </controls>
    </pages>
OR
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">
</ajaxToolkit:ToolkitScriptManager>

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"
    Format="dd/MM/yyyy">
</ajaxToolkit:CalendarExtender>

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 :

http://aspdotnethelpmaster.blogspot.in/
 

0 comments:

Post a Comment