Tuesday, 29 March 2016

Date Picker (Calendar) control in ASP.NET using AJAX

How To Use Date Picker (Calendar) Control in ASP.NET Website

Date Picker using AJAX

Step 1) Create New ASP.NET Empty Website and add new web form.
Step 2) Add reference of AjaxControltoolKit in your website as follow :-



Note:- for using AjaxControlToolkit in visual studio please first download it from internet (https://ajaxcontroltoolkit.codeplex.com) and save it to any location (for example download folder of your local drive) then browse it and look in your downloaded location. 
 
Step 3) Register AjaxControltoolkit on design page as follow : -

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ 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">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>
Screen Shot

Step 4) Add ToolKitScriptManager ,  asp textbox ,  asp image button and CalendarExtender as follow : -

<body>
    <form id="form1" runat="server">
    <div>
    
 <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </cc1:ToolkitScriptManager>
    <asp:TextBox ID="txtDate" runat="server" ReadOnly="true"></asp:TextBox>
    <asp:ImageButton ID="imgPopup"  ImageAlign="Bottom"
        runat="server" />
    <cc1:CalendarExtender ID="Calendar1" PopupButtonID="imgPopup" runat="server" TargetControlID="txtDate"
        Format="dd/MM/yyyy">
    </cc1:CalendarExtender>

    </div>
    </form>
</body>

screen shot
Note:- for using AjaxControlToolkit in visual studio please first downlo

No comments:

Post a Comment

SQL Table : Change Row As Column and Group Them... ( Setting column values as column names in the SQL query result )

Setting column values as column names in the SQL query result Problem Statement : id col1 col2 1 Pending 30 1 Resolved 48 ...