求助:calendar 程序错误
using System;using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing; / /提供对GDI和基本图形功能的访问
public partial class _Default : System.Web.UI.Page
{
string [,]arrCalendar=new string[12,31];
protected void Page_Load(object sender, EventArgs e)
{
if (!Cache("arrCalendar")) // 错误 1
arrCalendar = new string(12, 31); //错误 2 3
}
else
{
arrCalendar = Cache("arrCalendar"); // 错误 4
}
}
protected void Button1_Click(object sender, EventArgs e)
{
DateTime time = this.Calendar1.SelectedDate;
arrCalendar(time.Month, time.Day) = this.TextBox1.Text; // 错误 5
Cache("arrCalendar") = arrCalendar; // 错误 6
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
DateTime time = Calendar1.SelectedDate;
this.TextBox1.Text = arrCalendar(time.Month, time.Day); // 错误 7
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
DateTime time = e.Day.Date;
TableCell cell = e.Cell;
string task = arrCalendar(time.Month, time.Day); // 错误 8
if (task != "")
{
cell.BackColor = Color.FromName("red");
cell.Controls.Add(new LiteralControl("/n"));
cell.Controls.Add(new LiteralControl(task));
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url=http://www.]http://www.[/url]">
<html xmlns="[url=http://www.]http://www.[/url]" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div style="z-index: 101; left: 191px; width: 584px; position: absolute; top: 0px;
height: 482px">
<asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="#999999"
CellPadding="4" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt"
ForeColor="Black" Height="220px"
Width="241px">
<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
<SelectorStyle BackColor="#CCCCCC" />
<WeekendDayStyle BackColor="#FFFFCC" />
<OtherMonthDayStyle ForeColor="#808080" />
<NextPrevStyle VerticalAlign="Bottom" />
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
</asp:Calendar>
<asp:TextBox ID="TextBox1" runat="server" Height="125px" Width="179px"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="确认" /></div>
</div>
</form>
</body>
</html>
程序用vs2005编写,完成的功能是在日历控件中选中一个日期,在文本框中输入备忘内容,单击确认按钮后,日历中将添加并显示输入的备忘内容,并且这一天使用特殊颜色显示。
错误:
错误 1 “System.Web.UI.Page.Cache”是“属性”,但此处被当做“方法”来使用
错误 2 与“string.String(char, int)”最匹配的重载方法具有一些无效参数
错误 3 参数“1”: 无法从“int”转换为“char”
错误 4 “System.Web.UI.Page.Cache”是“属性”,但此处被当做“方法”来使用
错误 5 “_Default.arrCalendar”是“字段”,但此处被当做“方法”来使用
错误 6 “System.Web.UI.Page.Cache”是“属性”,但此处被当做“方法”来使用
错误 7 “_Default.arrCalendar”是“字段”,但此处被当做“方法”来使用
错误 8 “_Default.arrCalendar”是“字段”,但此处被当做“方法”来使用
编译错误的提示如上,怎样才能更改错误?
谢谢高手指点,拜谢!