Example #1
0
        protected void BaseCalendar1_RenderBodyDay(BaseCalendar sender, BaseTagContentDay tag)
        {
            // for every day and if the date is within the current visible month...
            if (!tag.Info.IsOtherMonth)
            {
                // we change the ID of the generated TD (inside TBODY > TR), maybe useful when using javascript
                tag.Id = "x_" + tag.Info.Date.Day;
                // just a demo that you can add/use style values (more than one) for each row
                //tag.Style.Add("cursor:pointer");

                // you can also add custom attributes, in this case "onclick"
                // The actual content of the cell can be anything, like other HTML tags. In this case
                // we render the day number like the calendar would render is we didn't have a DayTag
                // handler by we add an asterisk to show that it's different.
                tag.Content.Write("<div class=dayheader><a class='day' href='#' onclick=\"EditTask(0," + tag.Info.Date.ToString("yyyyMMdd")
                                  + ",'" + txtCustOwnerID.SelectedItem.Text + "');\">" + tag.DefaultText + ChineseCalendar.GetChineseShortDay(tag.Info.Date) + "</a></div>");

                //-----------根据人名,日期取得日程---------
                tag.Content.Write(svr.GetDayTagHtml(tag.Info.Date.ToString("yyyyMMdd"), txtCustOwnerID.SelectedItem.Text));
                //tag.Content.Write(tag.Info.Date.ToString("%d*", sender.CurrentDateTimeFormatInfo));
            }
            else
            {
                // Since we have a DayTag handler (this method) the calendar control doesn't output anything
                // by default (it lets us to our custom rendering). To help us out it puts the content it
                // would've normally rendered inside DefaultText, but it's still up to us to actually render it;
                // we just don't have to figure out what it would've rendered by default -- note that this is
                // exactly what we did in the other "if" branch...

                tag.Content.Write("");
            }
            // just to show that you can, a dummy "url" attribute with "sweet" inside
            tag.Attributes.Add("url", "sweet");
        }
Example #2
0
        protected void BaseCalendar1_RenderBodyDay(BaseCalendar sender, BaseTagContentDay tag)
        {
            // for every day and if the date is within the current visible month...
            if (!tag.Info.IsOtherMonth)
            {
                // we change the ID of the generated TD (inside TBODY > TR), maybe useful when using javascript
                tag.Id = "x_" + tag.Info.Date.Day;
                // just a demo that you can add/use style values (more than one) for each row
                //tag.Style.Add("cursor:pointer");

                // you can also add custom attributes, in this case "onclick"
                // The actual content of the cell can be anything, like other HTML tags. In this case
                // we render the day number like the calendar would render is we didn't have a DayTag
                // handler by we add an asterisk to show that it's different.
                tag.Content.Write("<div class=dayheader><a class='day' href='#' onclick=\"EditTask(0," + tag.Info.Date.ToString("yyyyMMdd")
                     + ",'" + txtCustOwnerID.SelectedItem.Text + "');\">" + tag.DefaultText + ChineseCalendar.GetChineseShortDay(tag.Info.Date) + "</a></div>");

                //-----------根据人名,日期取得日程---------
                tag.Content.Write(svr.GetDayTagHtml(tag.Info.Date.ToString("yyyyMMdd"), txtCustOwnerID.SelectedItem.Text));
                //tag.Content.Write(tag.Info.Date.ToString("%d*", sender.CurrentDateTimeFormatInfo));
            }
            else
            {
                // Since we have a DayTag handler (this method) the calendar control doesn't output anything
                // by default (it lets us to our custom rendering). To help us out it puts the content it
                // would've normally rendered inside DefaultText, but it's still up to us to actually render it;
                // we just don't have to figure out what it would've rendered by default -- note that this is
                // exactly what we did in the other "if" branch...

                tag.Content.Write("");
            }
            // just to show that you can, a dummy "url" attribute with "sweet" inside
            tag.Attributes.Add("url", "sweet");
        }
Example #3
0
        protected void CalendarBodyDay(BaseCalendar sender, BaseTagContentDay tag)
        {
            if (!tag.Info.IsOtherMonth)
            {
                tag.Content.WriteLine("<b><span class=\"emph1\">" + tag.DefaultText + "</span></b><br/>");

                var dayItems = items.Where(i => i.Start.GetValueOrDefault().Date == tag.Info.Date.Date).ToList();

                if (dayItems.Count > 0)
                {
                    tag.Content.WriteLine("<div class=\"calendarItems\">");

                    foreach (var item in dayItems)
                    {
                        if (item.AllDay)
                        {
                            tag.Content.WriteLine(string.Format("{0}<br />", item.Title));
                        }
                        else
                        {
                            tag.Content.WriteLine(
                                string.Format("<span class=\"emph1\">{0}:</span> {1}<br />",
                                item.Start.Value.ToString("t"), item.Title)
                            );
                        }
                    }

                    tag.Content.WriteLine("<br />");
                    tag.Content.WriteLine("</div>");
                }
            }
            else
            {
                tag.Content.WriteLine("<span class=\"calendarOtherMonth\">" + tag.DefaultText + "</span>");
            }
        }