Telerik.Web.Mvc.UI.CalendarHtmlBuilder.CellTag C# (CSharp) Method

CellTag() public method

public CellTag ( System.DateTime day, string urlFormat, bool isOtherMonth ) : IHtmlNode
day System.DateTime
urlFormat string
isOtherMonth bool
return IHtmlNode
        public IHtmlNode CellTag(DateTime day, string urlFormat, bool isOtherMonth)
        {
            IHtmlNode cell = new HtmlTag("td");

            if (isOtherMonth)
            {
                cell.AddClass("t-other-month");
            }
            else if(Calendar.Value != null && day.Day == Calendar.Value.Value.Day)
            {
                cell.AddClass(UIPrimitives.SelectedState);
            }

            if (Calendar.IsDateInRange(day))
            {
                var href = GetUrl(day, urlFormat);

                IHtmlNode link = new HtmlTag("a")
                                 .AddClass(UIPrimitives.Link + (href != "#" ? " t-action-link" : string.Empty))
                                 .Attribute("href", href)
                                 .Text(day.Day.ToString());

                cell.Children.Add(link);
            }
            else
            {
                cell.Html(" ");
            }

            return cell;
        }