ASP.NET Calendar控件使用问题
protectedvoidcalSchedule_DayRender(objectsender,DayRenderEventArgse){UserInfouser=(Us...
protected void calSchedule_DayRender(object sender, DayRenderEventArgs e)
{
UserInfo user = (UserInfo)Session["CurrentUser"];
//自定义显示内容
CalendarDay calDay = ((DayRenderEventArgs)e).Day;
//获取表示呈现在控件中的单元格
TableCell tc = ((DayRenderEventArgs)e).Cell;
//农历转换对象
CNDate dt = new CNDate(calDay.Date);
if (calDay.IsOtherMonth)
{
tc.Controls.Clear();
}
else
{
try
{
int scheduleId = ScheduleManager.GetScheduleId(user.UserId,calDay.Date.ToShortDateString());
Schedule schedule = ScheduleManager.GetScheduleByScheduleId(scheduleId);
HyperLink aHyperLink = new HyperLink();
aHyperLink.ImageUrl = "~/images/add_Schedule.gif";//日历里面的新增日程的图标
aHyperLink.ToolTip = "新增个人日程";
aHyperLink.NavigateUrl = "SaveMySchedule.aspx?userid="+user.UserId+"&today=" + calDay.Date.ToShortDateString();
tc.Controls.Add(new LiteralControl(" " + " " + " "));
tc.Controls.Add(aHyperLink);
tc.Controls.Add(new LiteralControl("<br>" + dt.GetLunarHolDay()));
if (scheduleId != 0)
{
HtmlAnchor ha = new HtmlAnchor();
ha.HRef = "SaveMySchedule.aspx?userid=" + user.UserId + "&today=" + calDay.Date.ToShortDateString();
ha.InnerText = "◎" + schedule.BeginTime.Hour.ToString() + ":" + schedule.BeginTime.Minute.ToString() + " " + schedule.Title.Substring(0, 3) + "...";
tc.Controls.Add(new LiteralControl(" " + " " + " "));
tc.Controls.Add(new LiteralControl("<br>"));
tc.Controls.Add(ha);
tc.Controls.Add(new LiteralControl("<br>"));
}
}
catch (Exception exc)
{
Response.Write(exc.ToString());
}
}
这段代码大概是说实现在按下日历某一日期 里面的绿色小图标 可以写日志的.
但不懂这Calendar控件如何使用...附图 高手帮忙 展开
{
UserInfo user = (UserInfo)Session["CurrentUser"];
//自定义显示内容
CalendarDay calDay = ((DayRenderEventArgs)e).Day;
//获取表示呈现在控件中的单元格
TableCell tc = ((DayRenderEventArgs)e).Cell;
//农历转换对象
CNDate dt = new CNDate(calDay.Date);
if (calDay.IsOtherMonth)
{
tc.Controls.Clear();
}
else
{
try
{
int scheduleId = ScheduleManager.GetScheduleId(user.UserId,calDay.Date.ToShortDateString());
Schedule schedule = ScheduleManager.GetScheduleByScheduleId(scheduleId);
HyperLink aHyperLink = new HyperLink();
aHyperLink.ImageUrl = "~/images/add_Schedule.gif";//日历里面的新增日程的图标
aHyperLink.ToolTip = "新增个人日程";
aHyperLink.NavigateUrl = "SaveMySchedule.aspx?userid="+user.UserId+"&today=" + calDay.Date.ToShortDateString();
tc.Controls.Add(new LiteralControl(" " + " " + " "));
tc.Controls.Add(aHyperLink);
tc.Controls.Add(new LiteralControl("<br>" + dt.GetLunarHolDay()));
if (scheduleId != 0)
{
HtmlAnchor ha = new HtmlAnchor();
ha.HRef = "SaveMySchedule.aspx?userid=" + user.UserId + "&today=" + calDay.Date.ToShortDateString();
ha.InnerText = "◎" + schedule.BeginTime.Hour.ToString() + ":" + schedule.BeginTime.Minute.ToString() + " " + schedule.Title.Substring(0, 3) + "...";
tc.Controls.Add(new LiteralControl(" " + " " + " "));
tc.Controls.Add(new LiteralControl("<br>"));
tc.Controls.Add(ha);
tc.Controls.Add(new LiteralControl("<br>"));
}
}
catch (Exception exc)
{
Response.Write(exc.ToString());
}
}
这段代码大概是说实现在按下日历某一日期 里面的绿色小图标 可以写日志的.
但不懂这Calendar控件如何使用...附图 高手帮忙 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询