我是C#初学者,借鉴网上的一些资料做了一个日历,请大家指点~
如果我在线,大家就可以看到这个展示: http://mindflying.vicp.net/calendar.aspx
此处是.aspx文件~
<%@ Page language="c#" Codebehind="calendar.aspx.cs" AutoEventWireup="false" Inherits="mindflying.calendar" %>
<!DOCTYPE HTML PUBLIC "-//W
<HTML>
<HEAD>
<title>calendar</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<table height="290" cellSpacing="0" cellPadding="0" width="202" border="0" align="center">
<tr>
<td vAlign="top">
<table height="26" cellSpacing="0" cellPadding="0" width="202" bgColor="#0080ff" border="0">
<tr>
<td height="4"></td>
</tr>
<tr>
<td width="15"></td>
<td>
<DIV align="left" style="FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: white">精美日历</DIV>
</td>
</tr>
</table>
<asp:calendar id="Calendar1" runat="server" BorderColor="#0080FF" BorderStyle="Double" DayNameFormat="Full"
Font-Bold="True" BorderWidth="2px" Width="100%" PrevMonthText='<IMG align="left" src="images/calendar01.gif" border="0">'
NextMonthText='<IMG align="right" src="images/calendar02.gif" border="0">' Font-Size="12px">
<TodayDayStyle ForeColor="White" BackColor="#FF8040"></TodayDayStyle>
<DayStyle BorderWidth="1px" BorderStyle="Solid" BorderColor="#E0E0E0"></DayStyle>
<DayHeaderStyle ForeColor="White" BackColor="#0080FF"></DayHeaderStyle>
<SelectedDayStyle ForeColor="White" BackColor="Green"></SelectedDayStyle>
<TitleStyle ForeColor="#330099" BackColor="#C8E3FF"></TitleStyle>
<WeekendDayStyle ForeColor="Red"></WeekendDayStyle>
<OtherMonthDayStyle ForeColor="Gainsboro"></OtherMonthDayStyle>
</asp:calendar>
</td>
</tr>
</table>
</form>
</body>
</HTML>
此处是.cs文件~
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Globalization;
using System.Threading;
namespace mindflying
{
/// <summary>
/// calendar 的摘要说明。
/// </summary>
public class calendar : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Calendar Calendar1;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
Thread threadCurrent = Thread.CurrentThread;
CultureInfo ciNew = (CultureInfo)threadCurrent.CurrentCulture.Clone();
ciNew.DateTimeFormat.DayNames = new string[]{"<font color=NavajoWhite>日</font>","一","二","三","四","五","<font color=NavajoWhite>六</font>"};
ciNew.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday;
threadCurrent.CurrentCulture = ciNew;
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}