Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi, i created one webpage in aspx. in which i want to display the Months and Year calendar,

whenever i am clicking in the text box. after picked the selective month and year in the calendar

control i want to display that Month and Year in the text box..

i am expecting the CSS Styles and Java script Events for that..


can u help??
Posted
Updated 15-Nov-19 20:35pm
Comments
Joezer BH 21-Jul-13 8:32am    
Hi Vivek,
It depends on the calendar control you are using buddy, show some code and we'll pick up

 
Share this answer
 
v2
Please check the below urls.

Jquery datepicker

Sample
Jquery datepicker sample
 
Share this answer
 
Hi...
Here add reference ajaxcontroltoolkit.dll. And then write
C#
 <asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown"></asp:textbox>
<asp:calendarextender id="calext1" runat="server" targetcontrolid="TextBox1" format="yyyy-MM-dd" cssclass="calext1" xmlns:asp="#unknown"></asp:calendarextender>

It wil show year and monthly wise.
Thank u.
 
Share this answer
 
Hi you should us jquery ui datepicker, that is easy and the best

http://jqueryui.com/datepicker/[^]
 
Share this answer
 
using form1.aspx

Quote:
<asp:ScriptManager ID="ScriptManager1" runat="server">



Quote:
<asp:TextBox ID="DateTextBox" runat="server">
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/2018-calendar-with-holidays.png" Height="16px" Width="16px" />
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="DateTextBox" PopupButtonID="Image1" />
<asp:Timer ID="Timer1" runat="server" >
 
Share this answer
 
ASP.NET
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function displayDate() {
            var Month = '<%= cal.SelectedDate.Date.Month %>';
            var Year = '<%= cal.SelectedDate.Date.Year %>';
           document.getElementById('<%=txtYear.ClientID %>').value = Year;
           document.getElementById('<%=txtMonth.ClientID %>').value = Month;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:Calendar ID="cal" runat="server"></asp:Calendar>
            <br />
            <asp:Button Text="Click" OnClientClick="displayDate();" runat="server" />
            <br />
            <asp:Label ID="lblYear" runat="server" Text="Year"></asp:Label>
            <asp:TextBox ID="txtYear"  runat="server"></asp:TextBox>
            <br />
            <asp:Label ID="lblMonth" runat="server" Text="Month"></asp:Label>
            <asp:TextBox ID="txtMonth"  runat="server"></asp:TextBox>
        </div>
    </form>
</body>
</html>
 
Share this answer
 
function displayDate() {
var Month = '';
var Year = '';
document.getElementById('').value = Year;
document.getElementById('').value = Month;
}

















function displayDate() {
var Month = '';
var Year = '';
document.getElementById('').value = Year;
document.getElementById('').value = Month;
}
 
Share this answer
 
Comments
Richard Deeming 18-Nov-19 16:14pm    
An unformatted, unexplained code-dump is not a solution, no matter how many times you repeat the same function, or how many line-breaks you put between the repeats.

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