当前位置: 首页>>代码示例>>C#>>正文


C# TemplateItem.RenderControl方法代码示例

本文整理汇总了C#中TemplateItem.RenderControl方法的典型用法代码示例。如果您正苦于以下问题:C# TemplateItem.RenderControl方法的具体用法?C# TemplateItem.RenderControl怎么用?C# TemplateItem.RenderControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TemplateItem的用法示例。


在下文中一共展示了TemplateItem.RenderControl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderTaskView

        /// <summary>
        /// Renders task view, which displays a gantt like 
        /// task view starting with a currently selected day for a month.
        /// </summary>
        /// <param name="writer">The HtmlTextWriter object that receives the content.</param>
        private void RenderTaskView(HtmlTextWriter writer)
        {
            //Initialize constants
            DateTime renderStartDate = TimescaleStartDate; //SelectedDate.Date;
            DateTime renderEndDate = TimescaleEndDate; //Helper.GetTaskEndDate(SelectedDate); // can be customized for zooming later
            int spanMax = (Helper.GetDaySpan(renderStartDate, renderEndDate) + 1);

            // Create weekday row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Render empty top left space
            writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2");
            RenderCellBorderAttributes(writer);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            if(TaskItemHeaderTemplate != null)
            {
                TemplateItem header = new TemplateItem();
                TaskItemHeaderTemplate.InstantiateIn(header);
                header.RenderControl(writer);
            }
            writer.RenderEndTag();

            for(DateTime cycleDate = TimescaleStartDate; cycleDate <= TimescaleEndDate; cycleDate = Helper.IncrementDate(TimescaleTopFormat, cycleDate, this.FirstDayOfWeek))
            {
                int colSpan = 0;
                bool exitLoop = false;

                // Detect if it spans out of boundaries
                if(Helper.IncrementDate(TimescaleTopFormat, cycleDate, this.FirstDayOfWeek) > this.TimescaleEndDate)
                {
                    colSpan = (int)((TimeSpan)(this.TimescaleEndDate - cycleDate)).TotalDays + 1;
                    exitLoop = true;
                }
                else
                    colSpan = (int)((TimeSpan)(Helper.IncrementDate(TimescaleTopFormat, cycleDate, this.FirstDayOfWeek) - cycleDate)).TotalDays;

                CalendarHeaderStyle.AddAttributesToRender(writer);
                RenderPaletteColor(writer, HtmlTextWriterStyle.BackgroundColor, CalendarHeaderStyle.BackColor, CalendarColorConstants.HeaderBackColor);
                RenderPaletteColor(writer, HtmlTextWriterStyle.Color, CalendarHeaderStyle.ForeColor, CalendarColorConstants.HeaderForeColor);
                writer.AddAttribute(HtmlTextWriterAttribute.Height, "17");
                // 13/1/2005 - Begin
                if (colSpan>0) // 13/1/2005 - End
                    writer.AddAttribute(HtmlTextWriterAttribute.Colspan, colSpan.ToString());
                RenderCellBorderAttributes(writer);
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                if(colSpan >= 7) // only render those items that can be fully displayed
                {
                    string href = "";

                    CalendarHeaderStyle.AddAttributesToRender(writer);
                    RenderPaletteColor(writer, HtmlTextWriterStyle.BackgroundColor, CalendarHeaderStyle.BackColor, CalendarColorConstants.HeaderBackColor);
                    RenderPaletteColor(writer, HtmlTextWriterStyle.Color, CalendarHeaderStyle.ForeColor, CalendarColorConstants.HeaderForeColor);

                    //  [9/15/2004]	---	Begin
                    if(this.DrillDownEnabled)
                    {
                        if(this.TimescaleTopFormat == TimescaleTopSpan.Month)
              href = "javascript:" + this.Page.ClientScript.GetPostBackEventReference(this, "OnSelectedViewChange," + cycleDate.ToShortDateString() + "," + CalendarViewType.MonthView.GetHashCode());
                        else
              href = "javascript:" + this.Page.ClientScript.GetPostBackEventReference(this, "OnSelectedViewChange," + cycleDate.ToShortDateString() + "," + CalendarViewType.WeekView.GetHashCode());
                        writer.AddAttribute(HtmlTextWriterAttribute.Href, href);
                        writer.RenderBeginTag(HtmlTextWriterTag.A);
                        RenderText(writer, cycleDate.ToString(TimescaleTopLabelFormat));
                        writer.RenderEndTag(); // </A>
                    }
                    else
                    {
                        href = cycleDate.ToShortDateString();
                        writer.AddAttribute(HtmlTextWriterAttribute.Value, href);
                        writer.RenderBeginTag(HtmlTextWriterTag.Div);
                        RenderText(writer, cycleDate.ToString(TimescaleTopLabelFormat));
                        writer.RenderEndTag(); // </Div>
                    }
                    //  [9/15/2004]	---	End
                }
                writer.RenderEndTag();

                if(exitLoop)
                    break;
            }

            writer.RenderEndTag(); //tr

            // Render month day numbers
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            for(DateTime cycleDate = renderStartDate;cycleDate <= renderEndDate;cycleDate = Helper.IncrementDate(MatrixSpan.DaySpan, cycleDate))
            {
                CalendarHeaderStyle.AddAttributesToRender(writer);
                RenderPaletteColor(writer, HtmlTextWriterStyle.BackgroundColor, CalendarHeaderStyle.BackColor, CalendarColorConstants.HeaderBackColor);
                RenderPaletteColor(writer, HtmlTextWriterStyle.Color, CalendarHeaderStyle.ForeColor, CalendarColorConstants.HeaderForeColor);
                writer.AddAttribute(HtmlTextWriterAttribute.Height, "17");
                writer.AddAttribute(HtmlTextWriterAttribute.Width, TaskItemWidth.ToString()); //  [9/15/2004]
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
                RenderCellBorderAttributes(writer);
//.........这里部分代码省略.........
开发者ID:0anion0,项目名称:IBN,代码行数:101,代码来源:Calendar.cs


注:本文中的TemplateItem.RenderControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。