Writing 3 different simple calendars in ASP.NET


With ASP.NET you can do almost everything you can imagine. In general sense, most of the web applications use basic calendars. With ASP.NET you can create simple calendars without having to use any kind of extra class. There are three basic ways you can create with the called “ASP.NET controls”. There are too many ASP.NET controls that can be applied to your web applications with an incredible level of performance and integration with the rest of the elements of your webpage. In this article you will see three examples that will be very useful for you as guidance for your forthcoming projects. The ASP.NET controls (such as calendars) can be customized and adapted to your needs. The following examples are inspired on our experience and research.

1. Simple Calendar (Version 1): You can name this file as you want and remember you need to have your web server running. It is just a basic code written in Macromedia Dreamweaver, but you can write in a simple and plain text editor such as Notepad or Microsoft Word Pad. The following example is for educative and research purposes you can copy it and use it for your tests in learning more about the use of ASP.NET controls.

<%@ Page Language=“VB” ContentType=“text/html” ResponseEncoding=”iso-8859-1″ %>

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>

<html>

<head>

<title>::..WEBSLAVE::..CALENDAR1</title>

<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>

</head>

<body>

<form runat=“server”>

<asp:Calendar runat=“server” />

</form>

</body>

</html>

2. Simple Calendar (Version 2): This second calendar is more complete having the list of the days of the week without abbreviations; it has full color and also has a mark in the current day. This script can be customized and you can change the back color, the font color and other relevant elements of this control.

<%@ Page Language=“VB” ContentType=“text/html” ResponseEncoding=”iso-8859-1″ %>

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>

<html>

<head>

<title>::..WEBSLAVE::..CALENDAR2</title>

<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>

</head>

<body>

<form runat=”server”>
<asp:Calendar DayNameFormat=”Full” runat=”server”>
<WeekendDayStyle BackColor=”#fafad2″ ForeColor=”#ff0000″ />
<DayHeaderStyle ForeColor=”#0000ff” />
<TodayDayStyle BackColor=”#00ff00″ />
</asp:Calendar>
</form></body>

</html>

3. Simple Calendar (Version 3): The following code is related to a calendar with different features to the previous calendars. This has a width similar the calendar (version 2) but it has a gray highlight that helps you to identify better the whole week you select. As matter as fact, this color can be customized according to your needs. You can also combine these features and test them.

<%@ Page Language=“VB” ContentType=“text/html” ResponseEncoding=”iso-8859-1″ %>

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>

<html>

<head>

<title>::..WEBSLAVE::..CALENDAR3</title>

<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>

</head>

<body>

<form runat=”server”>
<asp:Calendar DayNameFormat=”Full” runat=”server”
SelectionMode=”DayWeekMonth”
SelectMonthText=”<*>”
SelectWeekText=”<->”/>
<SelectorStyle BackColor=”#f5f5f5″ />
</asp:Calendar>
</form></html>

Final recommendations: Beside the great usability of calendars your creativity doesn’t have limits with these useful controls. These calendars can be adapted to your own style or according to the design of your web page or web application. Also, there are no limits with the font style, fore and back colors. ASP.NET is too flexible and customizable for this and the rest of ASP.NET controls.

You can leave a response, or trackback from your own site.

Leave a Reply

You must be logged in to post a comment.