如何在asp full日历中添加标签?

时间:2018-08-07 18:38:28

标签: jquery asp.net ajax

override func viewWillAppear(_ animated: Bool) {
    let navigationBack = UIView()
    navigationBack.frame = self.navigationController?.navigationBar.frame ?? CGRect.zero
    navigationBack.backgroundColor = navigationController?.navigationBar.barTintColor
    let containerView = transitionCoordinator?.containerView

    transitionCoordinator?.animateAlongsideTransition(in: containerView, animation: { (context) in
        containerView?.addSubview(navigationBack)
        navigationBack.frame.size.height = 44
    }, completion: { (context) in
        navigationBack.removeFromSuperview()
    })

    super.viewWillAppear(animated)
}

在上述日历的每一天都可以添加asp标签吗? 我可以在其中显示来自后面代码的文本的标签。 预先感谢!

1 个答案:

答案 0 :(得分:0)

我尝试使用如下所示的常规asp:calendar,并在后面的代码中显示标签。

<asp:Calendar ID="cal2" runat="server" Width="100%" DayField="Date" 
 OnDayRender="Calendar1_DayRender" BackColor="Orange" NextMonthText="Next" 
 PrevMonthText="Prev" OnVisibleMonthChanged="Calendar1_VisibleMonthChanged" >
<DayStyle CssClass="days" VerticalAlign="Top" Font-Name="Arial" Height="100px"   BackColor="lightYellow"  />
<TodayDayStyle BackColor="LightBlue"  />
<OtherMonthDayStyle BackColor="LightGray" ForeColor="DarkGray"/>
</asp:Calendar>

现在在一天渲染事件中,您可以使用LiteralControl来显示标签。

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
    e.Cell.ForeColor = System.Drawing.Color.Red;
    e.Cell.Font.Size = 9;
    e.Cell.Controls.Add(new LiteralControl("<p>Your label</p>"));
}