日期:2014-05-17  浏览次数:20884 次

求教Calendar日历控件的问题
本帖最后由 sunhai612 于 2013-04-24 09:36:41 编辑
 <asp:Calendar ID="Calendar2" runat="server" BackColor="#79A7E2" Font-Names="Verdana"
            Font-Size="8pt" Height="200px" Width="235px" ForeColor="Black" CellSpacing="1"
            NextPrevFormat="ShortMonth" OnDayRender="Calendar2_DayRender">
            <SelectedDayStyle BackColor="#CCCCFF" />
            <SelectorStyle BackColor="#FFCC66" />
            <TodayDayStyle BackColor="#999999" ForeColor="White" />
            <OtherMonthDayStyle ForeColor="#999999" />
            <DayStyle BackColor="White" CssClass="woody" />
            <NextPrevStyle Font-Size="3pt" ForeColor="white"  Width="100px" />
            <DayHeaderStyle Font-Bold="True" Height="8pt" Font-Size="9pt" ForeColor="#333333"
                BackColor="White" />
            <TitleStyle BackColor="#79A7E2" Font-Bold="True" Font-Size="8pt" ForeColor="white" />
        </asp:Calendar>

有这么一个日历,当鼠标放在日历上(不点击)如果是日期位置,会显示日期,其他部分显示“日历”,我不希望在鼠标移动到日历上时显示这些。我在某个日期内加了一个事件,当鼠标移动到这个日期上时ToolTip显示的是事件名称,而鼠标在其他位置无任何显示。请教各位大侠,怎么搞。。。。
这是后台代码:
protected void Calendar2_DayRender(object sender, DayRenderEventArgs e)
    {
      string date=DateTime.Now.ToShortDateString();
            if (DateTime.Parse(e.Day.Date.ToString()).ToShortDateString() == date)
            {
                e.Cell.Font.Underline = true;
                e.Cell.ForeColor = Color.Red;
                e.Cell.ToolTip = "上午十点开会\n";
                //this.hDueby.Value += e.Day.Date.ToString()+",";
            }
            else
            {
                e.Cell.ToolTip = "";
            }
        }
日历 ASP 服务器 控件

------解决方案--------------------<