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, 1:19 AM EDT
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, 1:55 AM EDT
give compelete discription
Sreenath MedikurthiPosted Aug 14, 2015, 4:02 AM EDT
not working in IE10
sayak guptaPosted Jun 27, 2015, 11:56 PM EDT
Its not working man!!
Avinash SinghPosted Apr 23, 2014, 3:15 AM EDT
when i m including this in master page of .aspx file it is not working help me out
lune lunaPosted Aug 13, 2012, 1:25 AM EDT
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, 2:27 AM EDT
This code is note working IE9. Plese Help
tawhidul islamPosted Apr 10, 2012, 2:58 AM EDT
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 10, 2012, 9:16 PM EST
As per you posted the code of "Calendar using javascript" - This code does not working correctly please check if possible
rani gPosted Apr 14, 2011, 8:58 PM EDT
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, 5:08 AM EDT
Sorry. worked like this. <a onclick="showCalendarControl(form1.PostedOn)" href="#">
pece angelPosted Mar 31, 2011, 5:00 AM EDT
does not work in firefox
Janak PadhyaPosted Mar 5, 2011, 8:38 PM EST
It's not works
Guest UserPosted Dec 20, 2010, 2:55 AM EST
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, 1:14 AM EST
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, 4:19 AM EDT
Hi Raj Kumar, this calender code not open in mozila . why Ravi
Venkatesh DesaiPosted Oct 22, 2010, 2:26 AM EDT
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 22, 2010, 10:43 PM EDT
it works, vimal
sac zadPosted Jun 28, 2010, 11:37 PM EDT
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, 2:52 AM EDT
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, 4:39 AM EDT
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, 3:32 AM EDT
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, 12:27 PM EDT
hey, this one is not working in firefox
raghu veditedPosted May 1, 2010, 6:37 AM EDTEdited May 1, 2010, 7:33 AM EDT
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, 6:35 AM EDT
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, 2:19 AM EDT
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, 1:56 AM EDTEdited Apr 25, 2010, 2:02 AM EDT
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 25, 2010, 7:47 PM ESTEdited Jan 25, 2010, 7:48 PM EST
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, 5:09 PM EST
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, 7:40 AM EST
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, 12:45 AM EST
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, 12:36 AM EDT
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, 12:35 AM EDT
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, 11:15 AM EDT
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, 11:11 AM EDT
This is good example of calender. Raj Thanks for it.
Sarfraz QasimPosted Jul 1, 2009, 10:20 AM EDT
Another very easy to use calendar control with so many customization options. http://www.design2develop.com/calendar/
Basant PandeyPosted May 21, 2009, 5:35 PM EDT
It's not working on firefox
THYAGARAJAN VALLIMANALANPosted May 18, 2009, 5:15 AM EDT
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, 9:16 AM EDT
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, 5:03 AM EDT
the selected date not display in asp textbox using firefox Reply me [email protected] also
pon rajPosted May 7, 2009, 5:00 AM EDT
the selected date not display in asp textbox using firefox
manjunath prasadPosted Apr 5, 2009, 11:42 PM EDT
not working in mozilla fire fox browser
thirumalai rajkumarPosted Mar 26, 2009, 9:45 AM EDT
hi thanks a lot.. it works awsome....
sathish oPosted Mar 12, 2009, 8:46 PM EDT
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, 1:22 PM EDT
Your Script looks great and works well in IE. but Can you help me run it in Mozilla too
suresh varmaPosted Feb 3, 2009, 7:50 PM EST
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 1, 2009, 11:15 PM EST
How to use the Calendar control in Java Script and also give the code for HTML
shankar kumarPosted Jan 12, 2009, 2:25 AM EST
Not working on mozila browser
powsul mohdPosted Dec 3, 2008, 6:43 PM EST
i have used CalendarUsingJavaScrip but can not view calendar in browser
powsul mohdPosted Dec 3, 2008, 6:41 PM EST
can't view the calendar of running mode in broweser
Ashish SharmaPosted Nov 30, 2008, 11:49 PM EST
Hi Raj, The control works fine with IE but the same can't be use in Mozilla. Thanks Ashish
kPosted Oct 13, 2008, 4:02 AM EDT
How to use it in Master page. am getting this error PosetedOn is undefined
narendra ojhaPosted Sep 28, 2008, 2:28 AM EDT
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, 10:58 AM EST
It does not work in a web page within a master page
pranPosted Feb 5, 2008, 12:46 AM EST
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, 2:36 AM EST
How to use it in Master page
karthik keyanPosted Nov 14, 2007, 9:09 PM EST
it is working fine in normal webpage