How to add label to asp full calendar?
Clash Royale CLAN TAG#URR8PPP
How to add label to asp full calendar?
<!DOCTYPE html>
<html>
<head runat="server">
<title>ASP.NET FullCalendar</title>
<link href="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/cupertino/jquery-ui.min.css" rel="stylesheet" />
<link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.css" rel="stylesheet" />
<link href="//cdnjs.cloudflare.com/ajax/libs/qtip2/3.0.3/jquery.qtip.min.css" rel="stylesheet" />
<link href="cal.css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
</asp:ScriptManager>
<div id="calendar">
</div>
<div runat="server" id="jsonDiv" />
<input type="hidden" id="hdClient" runat="server" />
</form>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/qtip2/3.0.3/jquery.qtip.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.js"></script>
<script src="scripts/calendarscript.js" type="text/javascript"></script>
</body>
</html>
Is there any way to add asp label on each days of the above calendar?
A label where I can display text from code behind.
Thanks in advance!
1 Answer
1
I tried using a normal asp:calendar as shown below and and display the label from code behind.
<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>
Now on the day render event you can use LiteralControl to show label.
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>"));
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.