示例#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");
        }