In this article, I am going to explain, how we can use a JavaScript Calendar control in ASP.NET 2.0. In this article I am using a JavaScript file (Calendar.js) and a CSS file (Calendar.css). JavaScript file has all functions and methods, which are used in calendar and CSS file has all calendar style sheets.
You can call JavaScript file on page like this:
<script language="javascript" src=Calendar.js type="text/javascript"></script>
and stylesheet file like this:
<link href=Calendar.css rel="stylesheet" type="text/css">
Here is a snapshot of Calendar control.

Figure 1:
You can call JavaScript file on a Button click event handler.

anfal kPosted Jun 22, 2017, 5:19 AM
Where do i insert the two line sof code you provided? the HTML? because i cannot insert the first one in the HTML file. I am using Visual Studio 2015
Rushabh MasterPosted Oct 7, 2015, 5:55 AM
give compelete discription
Sreenath MedikurthiPosted Aug 14, 2015, 8:02 AM
not working in IE10
sayak guptaPosted Jun 28, 2015, 3:56 AM
Its not working man!!
Avinash SinghPosted Apr 23, 2014, 7:15 AM
when i m including this in master page of .aspx file it is not working help me out
lune lunaPosted Aug 13, 2012, 5:25 AM
How can I add Today link in calender next to the CLose , I added a td but I dont what to right on js : table = table + "<tr class='header'><th colspan='3' style='padding: 3px; '><a href='javascript:hideCalendarControl();' >Today</a></td><th> </td><th colspan='3' style='padding: 3px;'><a href='javascript:hideCalendarControl();'>Close</a></td></tr>";
ajay sharanPosted May 7, 2012, 6:27 AM
This code is note working IE9. Plese Help
tawhidul islamPosted Apr 10, 2012, 6:58 AM
1. i want to show calendar under textbox where date show. 2. here when i select date but it did not show date in the textbox. 3. i use mozilla.
sunil khungerPosted Jan 11, 2012, 2:16 AM
As per you posted the code of "Calendar using javascript" - This code does not working correctly please check if possible
rani gPosted Apr 15, 2011, 12:58 AM
with out using input box how to get the date into text box?please send the code for getting the date into text box when we clicked on date button control
pece angelPosted Mar 31, 2011, 9:08 AM
Sorry. worked like this. <a onclick="showCalendarControl(form1.PostedOn)" href="#">
pece angelPosted Mar 31, 2011, 9:00 AM
does not work in firefox
Janak PadhyaPosted Mar 6, 2011, 1:38 AM
It's not works
Guest UserPosted Dec 20, 2010, 7:55 AM
Hello Buddy Your article is good and working . but i have a query on this . "I want to text-decoration overline on past dates" please help me urgent....
shobana AnnaduraiPosted Nov 20, 2010, 6:14 AM
i cant run this application in mozila.and also i changed that function parameter with in code.it's not working properly.plz reply me
ravi pandeyPosted Oct 28, 2010, 8:19 AM
Hi Raj Kumar, this calender code not open in mozila . why Ravi
Venkatesh DesaiPosted Oct 22, 2010, 6:26 AM
Hi Sir, My Requirement is that i want to place calender image and whenever we click on that image the calender will be Drop-Down & next is that whenever we selected the Date it wants to Displayed (OR) It wants to be Store in Database. Would u please help me to solve this problem? Thanks Regards VenkiDesai.
vimal prakashPosted Jul 23, 2010, 2:43 AM
it works, vimal
sac zadPosted Jun 29, 2010, 3:37 AM
Hello RajKumar, calender control is really good and very simple. but the thing is event is not firing using mozilla browser.
ShilpaPosted Jun 24, 2010, 6:52 AM
Hi Raj, I need to change the height and width of the calendar control. Is it possible to change your calendar control's height and width? Please reply...
Ajith KulgodPosted Jun 8, 2010, 8:39 AM
Hi This is working fine in IE but in mozilla Firefox calendar is not displaying........ Please can you solve my problem,,,,,,,,,,,,
prabhat dwivediPosted May 31, 2010, 7:32 AM
Hi, this is prabhat, I m using this calendar control it is very good! My requirement is that i want to date in dd/mm/yyyy format please help to change the format of the date for my page. how i can change the date format, plz reply ASAP
Suchita ManandharPosted May 12, 2010, 4:27 PM
hey, this one is not working in firefox
raghu veditedPosted May 1, 2010, 10:37 AMEdited May 1, 2010, 11:33 AM
hi, here goes my code in design </td> <td style="height: 25px; width: 110px;"> <span id="Label1" class="login-txt2">Effective Entry Date</span></td> <td style="height: 25px; width: 120px;"> <input name="txtEffectiveDate" type="text" id="txtEffectiveDate" class="all_txt_box_small" /></td> <td style="height: 25px"> <a onclick="showCalendarControl(txtEffectiveDate)" href="#"> <img alt="cal" src="calendar.gif" style="width: 20px; height: 20px" border="0"/></a> its works fine with ie and not with FF when i change the code as u stated in earlier posts i am able to pop the calender but now i am unable to get the date selected in calender to the text box pls help as this is an high priority one for me Thanks in adv Raghavendra.V
raghu vPosted May 1, 2010, 10:35 AM
hi, i am using the calender control in my asp.net page and i found that the control is working fine with ie it is not displaying the calender for FF and when i changed to the my js script to showCalendarControl(txtEffectiveDate) to showCalendarControl('txtEffectiveDate') calender control displaying in ie but i am unable to fetch the date to text box here goes my code for ur ref </td> <td style="height: 25px; width: 110px;"> <span id="Label1" class="login-txt2">Effective Entry Date</span></td> <td style="height: 25px; width: 120px;"> <input name="txtEffectiveDate" type="text" id="txtEffectiveDate" class="all_txt_box_small" /></td> <td style="height: 25px"> <a onclick="showCalendarControl(txtEffectiveDate)" href="#"> <img alt="cal" src="calendar.gif" style="width: 20px; height: 20px" border="0"/></a>
amit parmarPosted Apr 25, 2010, 6:19 AM
Hi raj! when i click on img button calendar popup but cant select date and its doent goes in input text. what should i do now??? plz guide me.....I like ur web site. its really helpful...thanx a lot
amit parmareditedPosted Apr 25, 2010, 5:56 AMEdited Apr 25, 2010, 6:02 AM
Hi bro! myself amit. I have download CalendarUsingJavaSript.zip. but its not working. when i click on calendar image pop up window doent open. <asp:Label ID="lblDateSent" runat="server" Text="Posted on:" CssClass="graytextbold"></asp:Label> <input ID="PostedOn" runat="server" class="NormalTextBox" readonly="readOnly" type="text" /> <a onclick="showCalendarControl(PostedOn)" href="#"><img src="calendar.gif" style="width: 20px; height: 20px" border="0" /></a> --> On class="NormalTextBox"" & CssClass="graytextbold this error gives--> "The class or cssClass value is not define". -->on img error is--> element img is required attributr alt (error is in Bold font) give me soultion. plz reply me. thanx
khin mar ooeditedPosted Jan 26, 2010, 12:47 AMEdited Jan 26, 2010, 12:48 AM
Dear All, The usage of this calendar control in my coding is like this. I wrote calendar control on content page. <asp:TextBox ID="txtDate" runat="server" AutoPostBack="true" Font-Names="Arial, Times New Roman, Verdana, Comic Sans MS, MS Sans Serif, Terminal,Tahoma, Sylfaen" Font-Size="12px" ForeColor="#000000" OnTextChanged="txtDate_TextChanged"></asp:TextBox> <a onclick="showCalendarControl('ctl00_ContentPlaceHolder1_txtDate')" href="#" > <img src="images/img.gif" style="width: 20px; height: 14px;border:none;" alt="Published Date"/></a> so I called like that. Selecting Date and Entering Date in Text box works fine in IE, but when I click image link, calendar does not show in Mozilla. When I enclosed with quote, this does not work on IE and Mozilla. Let me know the answer.
khin mar ooPosted Jan 24, 2010, 10:09 PM
Dear all Let me know how to solve about this problem. This Calendar Control does not work in firefox. Pls let me know as soon as possible.
minwei wangPosted Jan 24, 2010, 12:40 PM
Hi, Trying to use your calendar. I get error says can not located 'PostedOn' object. may have to do with ASP.NET Master page/Content page relationship no clue how to fix it, please help
raj bathulaPosted Nov 11, 2009, 5:45 AM
Hi Rajkumar I am using your script and css for showing calender popup. however i am getting a problem. ie., on click of button i am able to see calender but immediately it is disappearing without any action. please could you help me out in rectifying this issue? also plz reply fast as it is important for me a lot. thanks in advance frm Rajkumar
Alan JonesPosted Aug 6, 2009, 4:36 AM
This works great using Internet Exlorer, but does not work with Firefox. I am using 3.0.12 and when I click on the Calendar icon the following message is posted to the Firefox Error console window:- Error: PostedOn is not defined Source File: http://localhost:52696/CalendarUsingJavaScript/Calendar.aspx Line: 1 Can some please help me with this? Thanks Alan Jones ([email protected])
Alan JonesPosted Aug 6, 2009, 4:35 AM
This works great using Internet Exlorer, but does not work with Firefox. I am using 3.0.12 and when I click on the Calendar icon the following message is posted to the Firefox Error console window:- Error: PostedOn is not defined Source File: http://localhost:52696/CalendarUsingJavaScript/Calendar.aspx Line: 1 Can some please help me with this? Thanks Alan Jones
Vyom DixitPosted Jul 31, 2009, 3:15 PM
How can we validate in calender , if dates are greater than current date then how can be disable the calender days for selection?
Vyom DixitPosted Jul 31, 2009, 3:11 PM
This is good example of calender. Raj Thanks for it.
Sarfraz QasimPosted Jul 1, 2009, 2:20 PM
Another very easy to use calendar control with so many customization options. http://www.design2develop.com/calendar/
Basant PandeyPosted May 21, 2009, 9:35 PM
It's not working on firefox
THYAGARAJAN VALLIMANALANPosted May 18, 2009, 9:15 AM
hi raj, Sorry ya. the error was happend by me. The codes are works perfectly. Thanks for your wonder ful support. Thanks vallimanalan.t
THYAGARAJAN VALLIMANALANPosted May 17, 2009, 1:16 PM
hi, Calendar control was work perfectly.But while select two or three times, it will display differently like month = date ; date=month and calendar also display llike "undefined month". Please help to me... vallimanalan.t
pon rajPosted May 7, 2009, 9:03 AM
the selected date not display in asp textbox using firefox Reply me [email protected] also
pon rajPosted May 7, 2009, 9:00 AM
the selected date not display in asp textbox using firefox
manjunath prasadPosted Apr 6, 2009, 3:42 AM
not working in mozilla fire fox browser
thirumalai rajkumarPosted Mar 26, 2009, 1:45 PM
hi thanks a lot.. it works awsome....
sathish oPosted Mar 13, 2009, 12:46 AM
Am also trying to to do this but i haven't idea.I have problem that i want to hideen a asp: textbox and when a button click i want to show with javascript is it possible.
rajendra shresthaPosted Mar 12, 2009, 5:22 PM
Your Script looks great and works well in IE. but Can you help me run it in Mozilla too
suresh varmaPosted Feb 4, 2009, 12:50 AM
Calendar is not visible to me . in .js file all method are defined but not called,when will we call these methods
Allah AkbarPosted Feb 2, 2009, 4:15 AM
How to use the Calendar control in Java Script and also give the code for HTML
shankar kumarPosted Jan 12, 2009, 7:25 AM
Not working on mozila browser
powsul mohdPosted Dec 3, 2008, 11:43 PM
i have used CalendarUsingJavaScrip but can not view calendar in browser
powsul mohdPosted Dec 3, 2008, 11:41 PM
can't view the calendar of running mode in broweser
Ashish SharmaPosted Dec 1, 2008, 4:49 AM
Hi Raj, The control works fine with IE but the same can't be use in Mozilla. Thanks Ashish
kPosted Oct 13, 2008, 8:02 AM
How to use it in Master page. am getting this error PosetedOn is undefined
narendra ojhaPosted Sep 28, 2008, 6:28 AM
HI RAj, This is Naren here. How r you. if you dont mind may i know where are you from. I think you must be from Rajasthan. Any way waiting for your reply on [email protected]
amyPosted Feb 22, 2008, 3:58 PM
It does not work in a web page within a master page
pranPosted Feb 5, 2008, 5:46 AM
The calendar is good but can you see to it that it works in other browsers like Mozilla, it will be grateful Regards, Praneeth
Laxman CHPosted Dec 11, 2007, 7:36 AM
How to use it in Master page
karthik keyanPosted Nov 15, 2007, 2:09 AM
it is working fine in normal webpage