Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
3.69/5 (3 votes)
when text box clicked i want to show calender to select date


not using AJAX or MVC
Posted
Updated 30-Dec-18 20:47pm
v2

Have you tried anything about your Question?

Options here:

Jquery
http://jqueryui.com/datepicker/[^]

Ajax
http://www.ajaxcontroltoolkit.com/Calendar/Calendar.aspx[^]

Bootstrap
http://www.eyecon.ro/bootstrap-datepicker/[^]

Choose and Start :)
 
Share this answer
 
v2
First we have to add AJAX Control Toolkit in project references.

We need to register the AJAX Control Toolkit on the page.

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

Below is the HTML Markup which consists of a TextBox, an ImageButton and an ASP.Net AJAX CalendarExtender control.

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

<asp:TextBox ID="txtDate" runat="server" ReadOnly="true">
<asp:ImageButton ID="imgPopup" ImageUrl="images/calendar.png" ImageAlign="Bottom"
runat="server" />
<cc1:CalendarExtender ID="Calendar1" PopupButtonID="imgPopup" runat="server" TargetControlID="txtDate"
Format="dd/MM/yyyy">
 
Share this answer
 
v2
<asp:TextBox ID="txtSelectDate" runat="server" TextMode="Date"></asp:TextBox>
 
Share this answer
 
XML
<asp:TextBox Text="demo" ID="TextBox6" runat="server" /> <asp:ImageButton ID="imgPopup" ImageUrl="images/calendar_icon.png" ImageAlign="Bottom" OnClick="show_date"
runat="server" /><asp:Calendar id="Calendar1" Visible="false" onselectionchanged="Date_Selected" runat="server" />



--------------------
VB
Sub Date_Selected(ByVal sender As Object, ByVal e As EventArgs)
        TextBox6.Text = Calendar1.SelectedDate.ToShortDateString
        Calendar1.Visible = "false"

    End Sub

    Sub show_date()
        If Calendar1.Visible = "true" Then
            Calendar1.Visible = "false"
        Else
            Calendar1.Visible = "true"
            TextBox6.Text = ""
        End If

    End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900