CodeSnip: How to Create an Extended Calendar in ASP.NET
page 2 of 5
by Nidal Arabi
Feedback
Average Rating: 
Views (Total / Last 10 Days): 23688/ 55

Solution

Let us jumpstart into Visual Studio .NET 2003 directly and create a new ASP.NET project which is going to be called ECalendar.

1.      Open Visual Studio .NET 2003 and create a new project of the type ASP.NET.

2.      Drag a label and put it on the web form and then give it a text property a value of My Date.

3.      Afterwards, drag a text from toolbox into it and name it TxtMyDate.

4.      Switch to the HTML view of webform1 and locate the end of the Textbox tag.

5.      Insert the following HTML section after it.

Listing 1

<A href="javascript:openCalendar('TxtMyDate');"><IMG id="IMG6" src="CALENDAR.BMP" runat="server"></A>

6.      Note that the image src tag is referring to a picture.  From the source code (that you can download at the end of this article) you can get the picture or you may choose to select a different picture for the project.

7.      Since we are a calling a JavaScript window with a function called OpenCalendar, we need to give the HTML code that is also in webform1 HTML part inside the header tag.

Listing 2

<script language="javascript" type="text/javascript">
function openCalendar(txt)
{   
window.open('mycal.aspx?textbox=' + txt,'cal','width=250,height=220,left=570,top=180');
}
</script>

8.      By now your WebForm is complete, so let us turn to the calendar page.

9.      You may either use the MyCal.aspx form provided with the solution (copy all the files entitled MyCal.* into the solution directory and include them in the project) or choose to implement the whole form from scratch.  In both cases it is strongly recommended to go and read the whole article published by Mehmet Genc.

10.  Your webform1 should look something like figure 1.

Figure 1


View Entire Article

User Comments

Title: argh!   
Name: helena
Date: 2010-03-30 11:09:16 PM
Comment:
Elaborate!! Terrible instructions & broken links to follow

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-24 4:59:50 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search