System.Web.UI.WebControls Namespace Calendar Class
Initializes a new instance of the Calendar class.
[ VB ]
Public Sub New ( )
[ C# ]
public Calendar ( );
[ C++ ]
public: Calendar ( );
[ JScript ]
public function Calendar ( );
Use this constructor to create and initialize a new instance of the Calendar class.
The following example demonstrates how to create and initialize a new instance of the Calendar class.
<%@ Page Language = "C#" %>
<html>
<head>
<script runat = "server">
void Page_Load ( Object src, EventArgs e ) {
// create new Calendar control.
Calendar myCalendar=new Calendar ( );
// set Calendar properties.
myCalendar.OtherMonthDayStyle.ForeColor=System.Drawing.Color.Gray;
myCalendar.TitleStyle.BackColor=System.Drawing.Color.Blue;
myCalendar.TitleStyle.ForeColor=System.Drawing.Color.White;
myCalendar.DayStyle.BackColor=System.Drawing.Color.Gray;
myCalendar.SelectionMode=CalendarSelectionMode.DayWeekMonth;
myCalendar.ShowNextPrevMonth=true;
// add Calendar control to Controls collection.
Form1.Controls.Add ( myCalendar );
}
</script>
</head>
<body>
<form id = "Form1" runat = "server">
<h3>Calendar Example</h3>
</form>
</body>
</html>
<%@ Page Language = "VB" %>
<html>
<head>
<script runat = "server">
Sub Page_Load ( src As Object, e As EventArgs )
' create new Calendar control.
Dim myCalendar as Calendar=New Calendar
' Set Calendar properties.
myCalendar.OtherMonthDayStyle.ForeColor=System.Drawing.Color.Gray
myCalendar.TitleStyle.BackColor=System.Drawing.Color.Blue
myCalendar.TitleStyle.ForeColor=System.Drawing.Color.White
myCalendar.DayStyle.BackColor=System.Drawing.Color.Gray
myCalendar.SelectionMode=CalendarSelectionMode.DayWeekMonth
myCalendar.ShowNextPrevMonth=true
' add Calendar control to Controls collection.
Form1.Controls.Add ( myCalendar )
End Sub 'Page_Load
</script>
</head>
<body>
<form id = "Form1" runat = "server">
<h3>Calendar Example</h3>
</form>
</body>
</html> |
|
C# |
VB |
Calendar Members