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


C# Table.ApplyStyle方法代码示例

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


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

示例1: GetDesignTimeHtml

 public override string GetDesignTimeHtml()
 {
     var style = new TableStyle();
     var table = new Table();
     var component = Component as DeluxeSearch;
     var writer = new StringWriter();
     var html = new HtmlTextWriter(writer);
     if (null != component)
     {
         if (component.Categories.Count > 0)
         {
             foreach (var item in component.Categories)
             {
                 var cell = new TableCell();
                 var row = new TableRow();
                 cell.Text = string.Format("{0}:{1}", item.DataTextField, item.DataSourceID);
                 row.Cells.Add(cell);
                 table.Rows.Add(row);
             }
         }
         else
         {
             var cell = new TableCell();
             var row = new TableRow();
             cell.Text = component.ID;
             row.Cells.Add(cell);
             table.Rows.Add(row);
         }
         table.ApplyStyle(style);              
         table.RenderControl(html);
     }
     return writer.ToString();
 }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:33,代码来源:DeluxeSearchDesigner.cs

示例2: Create

 public override void Create(Control container, IConfigurationType config, ITemplatable templatable, IBinder binder, ITemplatingItem item, int itemIndex, WebPartManager manager)
 {
     if (null == container)
     {
         throw new ArgumentNullException("container");
     }
     if (null == config)
     {
         throw new ArgumentNullException("config");
     }
     if (!(config is IConfigurationSection))
     {
         throw new ArgumentException("config must be an IConfigurationSection");
     }
     if ((config as IConfigurationSection).Elements.ContainsKey("totals"))
     {
         Table table;
         if (container is Table)
         {
             table = (container as Table);
         }
         else
         {
             table = new Table();
             table.ApplyStyle(templatable.TotalsStyle);
         }
         IConfigurationElement element = (config as IConfigurationSection).GetElementReference("totals");
         foreach (IConfigurationElement rowElement in element.Elements.Values)
         {
             this.DisplayItem(table, rowElement, "totals" + itemIndex.ToString(), binder, item, templatable.TotalsRowStyle, templatable.InvalidItemStyle, manager);
         }
         if (!(container is Table))
         {
             container.Controls.Add(table);
         }
     }
 }
开发者ID:t1b1c,项目名称:lwas,代码行数:37,代码来源:TotalsTemplate.cs

示例3: OnInit

 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     this.updatePanel = new UpdatePanel();
     this.updatePanel.ID = "updatePanel";
     Table table = new Table();
     table.ApplyStyle(this._tableStyle);
     TableRow tableRow = new TableRow();
     TableCell tableCell = new TableCell();
     this.hiddenResultsCount = new HiddenField();
     this.hiddenResultsCount.ID = "hiddenResultsCount";
     tableCell.Controls.Add(this.hiddenResultsCount);
     this.hiddenCurrentPage = new HiddenField();
     this.hiddenCurrentPage.ID = "hiddenCurrentPage";
     tableCell.Controls.Add(this.hiddenCurrentPage);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.firstButton = new Button();
     this.firstButton.CssClass = "paginater_first";
     this.firstButton.Click += new EventHandler(this.firstButton_Click);
     tableCell.Controls.Add(this.firstButton);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.backwardButton = new Button();
     this.backwardButton.CssClass = "paginater_left";
     this.backwardButton.Click += new EventHandler(this.backwardButton_Click);
     tableCell.Controls.Add(this.backwardButton);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.currentLabel = new Label();
     this.currentLabel.ApplyStyle(this._labelStyle);
     this.currentLabel.Text = "0";
     tableCell.Controls.Add(this.currentLabel);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.ofLabel = new Label();
     this.ofLabel.ApplyStyle(this._labelStyle);
     this.ofLabel.Text = this._ofText;
     tableCell.Controls.Add(this.ofLabel);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.totalLabel = new Label();
     this.totalLabel.ApplyStyle(this._labelStyle);
     this.totalLabel.Text = "0";
     tableCell.Controls.Add(this.totalLabel);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.forwardButton = new Button();
     this.forwardButton.CssClass = "paginater_right";
     this.forwardButton.Click += new EventHandler(this.forwardButton_Click);
     tableCell.Controls.Add(this.forwardButton);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.lastButton = new Button();
     this.lastButton.CssClass = "paginater_last";
     this.lastButton.Click += new EventHandler(this.lastButton_Click);
     tableCell.Controls.Add(this.lastButton);
     tableRow.Controls.Add(tableCell);
     table.Rows.Add(tableRow);
     this.updatePanel.ContentTemplateContainer.Controls.Add(table);
     this.Controls.Add(this.updatePanel);
 }
开发者ID:t1b1c,项目名称:lwas,代码行数:62,代码来源:Paginater.cs

示例4: WriteTitle

		void WriteTitle (HtmlTextWriter writer)
		{
			TableCell cellNextPrev = null;
			TableCell titleCell = new TableCell ();
			Table tableTitle = new Table ();

			writer.RenderBeginTag (HtmlTextWriterTag.Tr);

			titleCell.ColumnSpan = HasWeekSelectors (SelectionMode) ? 8 : 7;

			if (titleStyle != null && !titleStyle.IsEmpty && !titleStyle.BackColor.IsEmpty) {
				titleCell.BackColor = titleStyle.BackColor;
			} else {
				titleCell.BackColor = Color.Silver;
			}

			titleCell.RenderBeginTag (writer);

			// Table
			tableTitle.Width =  Unit.Percentage (100);
			if (titleStyle != null && !titleStyle.IsEmpty) {
				tableTitle.ApplyStyle (titleStyle);
			}

			tableTitle.RenderBeginTag (writer);
			writer.RenderBeginTag (HtmlTextWriterTag.Tr);

			if (ShowNextPrevMonth) { // Previous Table Data
				cellNextPrev = new TableCell ();
				cellNextPrev.ApplyStyle (nextPrevStyle);
				cellNextPrev.Width = Unit.Percentage (15);

				DateTime date = GetGlobalCalendar().AddMonths (DisplayDate, - 1);
				date = GetGlobalCalendar ().AddDays (date, -date.Day + 1);
				cellNextPrev.RenderBeginTag (writer);
				writer.Write (BuildLink ("V" + GetDaysFromZenith (date), GetNextPrevFormatText (date, false), cellNextPrev.ForeColor, Enabled));
				cellNextPrev.RenderEndTag (writer);
			}

			// Current Month Table Data
			{
				DateTimeFormatInfo dti = DateInfo;
				string str;
				TableCell cellMonth = new TableCell ();
				cellMonth.Width = Unit.Percentage (70);
				cellMonth.HorizontalAlign = HorizontalAlign.Center;

				cellMonth.RenderBeginTag (writer);

				if (TitleFormat == TitleFormat.MonthYear)
					str = DisplayDate.ToString (dti.YearMonthPattern, dti);
				else
					str = dti.GetMonthName (GetGlobalCalendar ().GetMonth (DisplayDate));

				writer.Write (str);
				cellMonth.RenderEndTag (writer);
			}

			if (ShowNextPrevMonth) { // Next Table Data
				DateTime date = GetGlobalCalendar().AddMonths (DisplayDate, + 1);
				date = GetGlobalCalendar ().AddDays (date, -date.Day + 1);

				cellNextPrev.HorizontalAlign = HorizontalAlign.Right;
				cellNextPrev.RenderBeginTag (writer);
				writer.Write (BuildLink ("V" + GetDaysFromZenith (date), GetNextPrevFormatText (date, true), cellNextPrev.ForeColor, Enabled));
				cellNextPrev.RenderEndTag (writer);
			}

			writer.RenderEndTag ();
			tableTitle.RenderEndTag (writer);
			titleCell.RenderEndTag (writer);
			writer.RenderEndTag (); //tr

		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:74,代码来源:Calendar.cs

示例5: RenderContents

		protected override void RenderContents (HtmlTextWriter writer)
		{
			if (Controls.Count == 0)
				return;

			RepeatInfo repeater = new RepeatInfo ();
			Table templateTable = null;
			if (extractTemplateRows) {
				repeater.RepeatDirection = RepeatDirection.Vertical;
				repeater.RepeatLayout  = RepeatLayout.Flow;
				repeater.RepeatColumns = 1;
				repeater.OuterTableImplied = true;
				
				templateTable = new Table ();
				templateTable.ID = ClientID;
				templateTable.CopyBaseAttributes (this);
				templateTable.ApplyStyle (ControlStyle);
				templateTable.RenderBeginTag (writer);
			} else {
				repeater.RepeatDirection = RepeatDirection;
				repeater.RepeatLayout = RepeatLayout;
				repeater.RepeatColumns = RepeatColumns;
			}

			repeater.RenderRepeater (writer, this, ControlStyle, this);
			if (templateTable != null) {
				templateTable.RenderEndTag (writer);
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:29,代码来源:DataList.cs

示例6: Render

 protected internal override void Render(HtmlTextWriter writer)
 {
     bool isEnabled;
     this.threadCalendar = DateTimeFormatInfo.CurrentInfo.Calendar;
     this.minSupportedDate = this.threadCalendar.MinSupportedDateTime;
     this.maxSupportedDate = this.threadCalendar.MaxSupportedDateTime;
     DateTime visibleDate = this.EffectiveVisibleDate();
     DateTime firstDay = this.FirstCalendarDay(visibleDate);
     CalendarSelectionMode selectionMode = this.SelectionMode;
     if (this.Page != null)
     {
         this.Page.VerifyRenderingInServerForm(this);
     }
     if ((this.Page == null) || base.DesignMode)
     {
         isEnabled = false;
     }
     else
     {
         isEnabled = base.IsEnabled;
     }
     this.defaultForeColor = this.ForeColor;
     if (this.defaultForeColor == Color.Empty)
     {
         this.defaultForeColor = DefaultForeColor;
     }
     this.defaultButtonColorText = ColorTranslator.ToHtml(this.defaultForeColor);
     Table table = new Table();
     if (this.ID != null)
     {
         table.ID = this.ClientID;
     }
     table.CopyBaseAttributes(this);
     if (base.ControlStyleCreated)
     {
         table.ApplyStyle(base.ControlStyle);
     }
     table.Width = this.Width;
     table.Height = this.Height;
     table.CellPadding = this.CellPadding;
     table.CellSpacing = this.CellSpacing;
     if ((!base.ControlStyleCreated || !base.ControlStyle.IsSet(0x20)) || this.BorderWidth.Equals(Unit.Empty))
     {
         table.BorderWidth = Unit.Pixel(1);
     }
     if (this.ShowGridLines)
     {
         table.GridLines = GridLines.Both;
     }
     else
     {
         table.GridLines = GridLines.None;
     }
     bool useAccessibleHeader = this.UseAccessibleHeader;
     if (useAccessibleHeader && (table.Attributes["title"] == null))
     {
         table.Attributes["title"] = System.Web.SR.GetString("Calendar_TitleText");
     }
     string caption = this.Caption;
     if (caption.Length > 0)
     {
         table.Caption = caption;
         table.CaptionAlign = this.CaptionAlign;
     }
     table.RenderBeginTag(writer);
     if (this.ShowTitle)
     {
         this.RenderTitle(writer, visibleDate, selectionMode, isEnabled, useAccessibleHeader);
     }
     if (this.ShowDayHeader)
     {
         this.RenderDayHeader(writer, visibleDate, selectionMode, isEnabled, useAccessibleHeader);
     }
     this.RenderDays(writer, firstDay, visibleDate, selectionMode, isEnabled, useAccessibleHeader);
     table.RenderEndTag(writer);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:76,代码来源:Calendar.cs

示例7: CreateChildControls

        /// <summary>
        /// Builds the UI of the control
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            // A context menu is an invisible DIV that is moved around via scripting when the user
            // right-clicks on a bound HTML tag
            HtmlGenericControl div = new HtmlGenericControl("div");
            div.ID = "Root";
            div.Style["display"] = "none";
            div.Style["position"] = "absolute";
            div.Style["text-align"] = "left";
            if (AutoHide)
                div.Attributes["onmouseleave"] = "this.style.display='none'";

            Table menu = new Table();
            menu.ApplyStyle(CreateControlStyle());
            menu.CellSpacing = 1;
            menu.CellPadding = CellPadding;
            div.Controls.Add(menu);

            // Loop on ContextMenuItems and add rows to the table
            foreach(ContextMenuItem item in ContextMenuItems)
            {
                // Create and add the menu item
                TableRow menuItem = new TableRow();
                menu.Rows.Add(menuItem);

                // Configure the menu item
                TableCell container = new TableCell();
                menuItem.Cells.Add(container);

                // Define the menu item's contents
                if( item.Text == String.Empty || item.Text == null)
                {
                    // Empty item is a separator
                    container.Controls.Add(new LiteralControl(ContextMenu.HrSeparator));
                }
                else
                {
                    // Add roll-over capabilities
                    container.Attributes["onmouseover"] = String.Format(ContextMenu.OnMouseOver, ColorTranslator.ToHtml(RolloverColor));
                    container.Attributes["onmouseout"] = String.Format(ContextMenu.OnMouseOut, ColorTranslator.ToHtml(BackColor));

                    // Add the link for post back
                    LinkButton button = new LinkButton();
                    container.Controls.Add(button);
                    button.Click += new EventHandler(ButtonClicked);
                    button.Width = Unit.Percentage(100);
                    button.ToolTip = item.Tooltip;
                    button.Text = item.Text;
                    button.CommandName = item.CommandName;
                    button.CommandArgument = this.UniqueID;
                }
            }

            // Add the button to the control's hierarchy for display
            Controls.Add(div);

            // Inject any needed script code into the page
            EmbedScriptCode();

            // Inject the script code for all bound controls
            foreach(Control c in BoundControls)
            {
                WebControl ctl1 = (c as WebControl);
                HtmlControl ctl2 = (c as HtmlControl);

                if (ctl1 != null)
                    ctl1.Attributes["oncontextmenu"] = GetMenuReference();

                if (ctl2 != null)
                    ctl2.Attributes["oncontextmenu"] = GetMenuReference();
            }
        }
开发者ID:kohku,项目名称:codefactory,代码行数:77,代码来源:ContextMenu.cs

示例8: RenderContents

        /// <internalonly/>
        /// <devdoc>
        /// </devdoc>
        protected internal override void RenderContents(HtmlTextWriter writer) {
            if (Controls.Count == 0)
                return;

            RepeatInfo repeatInfo = new RepeatInfo();
            Table outerTable = null;

            // NOTE: This will end up creating the ControlStyle... Ideally we would
            //       not create the style just for rendering, but turns out our default
            //       style isn't empty, and does have an effect on rendering, and must
            //       therefore always be created
            Style style = ControlStyle;

            if (extractTemplateRows) {
                // The table tags in the templates are stripped out and only the
                // <tr>'s and <td>'s are assumed to come from the template itself.
                // This is equivalent to a flow layout of <tr>'s in a single
                // vertical column.

                repeatInfo.RepeatDirection = RepeatDirection.Vertical;
                repeatInfo.RepeatLayout = RepeatLayout.Flow;
                repeatInfo.RepeatColumns = 1;

                repeatInfo.OuterTableImplied = true;
                outerTable = new Table();

                // use ClientID (and not ID) since we want to render the fully qualified
                // ID even though the control will not be parented to the control hierarchy
                outerTable.ID = ClientID;

                outerTable.CopyBaseAttributes(this);
                outerTable.Caption = Caption;
                outerTable.CaptionAlign = CaptionAlign;
                outerTable.ApplyStyle(style);
                outerTable.RenderBeginTag(writer);
            }
            else {
                repeatInfo.RepeatDirection = RepeatDirection;
                repeatInfo.RepeatLayout = RepeatLayout;
                repeatInfo.RepeatColumns = RepeatColumns;
                if (repeatInfo.RepeatLayout == RepeatLayout.Table) {
                    repeatInfo.Caption = Caption;
                    repeatInfo.CaptionAlign = CaptionAlign;
                    repeatInfo.UseAccessibleHeader = UseAccessibleHeader;
                }
                else {
                    repeatInfo.EnableLegacyRendering = EnableLegacyRendering;
                }
            }

            repeatInfo.RenderRepeater(writer, (IRepeatInfoUser)this, style, this);
            if (outerTable != null)
                outerTable.RenderEndTag(writer);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:57,代码来源:DataList.cs

示例9: ConvertTableToHtmlTable

 private string ConvertTableToHtmlTable(Table originalTable, System.Web.UI.Control container, IDictionary persistMap)
 {
     IList list = new ArrayList();
     foreach (System.Web.UI.Control control in originalTable.Controls)
     {
         list.Add(control);
     }
     Table child = new Table();
     foreach (System.Web.UI.Control control2 in list)
     {
         child.Controls.Add(control2);
     }
     if (originalTable.ControlStyleCreated)
     {
         child.ApplyStyle(originalTable.ControlStyle);
     }
     child.Width = ((WebControl) base.ViewControl).Width;
     child.Height = ((WebControl) base.ViewControl).Height;
     if (container != null)
     {
         container.Controls.Add(child);
         container.Controls.Remove(originalTable);
     }
     IDesignerHost service = (IDesignerHost) this.GetService(typeof(IDesignerHost));
     if (persistMap != null)
     {
         foreach (string str in persistMap.Keys)
         {
             System.Web.UI.Control control3 = child.FindControl(str);
             if ((control3 != null) && control3.Visible)
             {
                 control3.ID = (string) persistMap[str];
                 LiteralControl control4 = new LiteralControl(ControlPersister.PersistControl(control3, service));
                 control3.Parent.Controls.Add(control4);
                 control3.Parent.Controls.Remove(control3);
             }
         }
     }
     foreach (string str3 in _persistedControlIDs)
     {
         System.Web.UI.Control control5 = child.FindControl(str3);
         if (control5 != null)
         {
             if (Array.IndexOf<string>(_persistedIfNotVisibleControlIDs, str3) >= 0)
             {
                 control5.Visible = true;
                 control5.Parent.Visible = true;
                 control5.Parent.Parent.Visible = true;
             }
             if (str3 == "ErrorMessage")
             {
                 TableCell parent = (TableCell) control5.Parent;
                 parent.ForeColor = Color.Red;
                 parent.ApplyStyle(this._createUserWizard.ErrorMessageStyle);
                 control5.EnableViewState = false;
             }
             if (control5.Visible)
             {
                 LiteralControl control6 = new LiteralControl(ControlPersister.PersistControl(control5, service));
                 control5.Parent.Controls.Add(control6);
                 control5.Parent.Controls.Remove(control5);
             }
         }
     }
     StringWriter writer = new StringWriter(CultureInfo.CurrentCulture);
     HtmlTextWriter writer2 = new HtmlTextWriter(writer);
     child.RenderControl(writer2);
     return writer.ToString();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:69,代码来源:CreateUserWizardDesigner.cs

示例10: Render

		protected override void Render(HtmlTextWriter writer)
		{
			globCal = DateTimeFormatInfo.CurrentInfo.Calendar;
			DateTime visDate   = GetEffectiveVisibleDate();
			DateTime firstDate = GetFirstCalendarDay(visDate);

			bool isEnabled;
			bool isHtmlTextWriter;
			//FIXME: when Control.Site works, reactivate this
			//if (Page == null || Site == null) {
			//	isEnabled = false;
			//	isHtmlTextWriter = false;
			//} else {
				isEnabled = Enabled;
				isHtmlTextWriter = (writer.GetType() != typeof(HtmlTextWriter));
			//}
			defaultTextColor = ForeColor;
			if(defaultTextColor == Color.Empty)
				defaultTextColor = Color.Black;

			Table calTable = new Table ();
			calTable.ID = ID;
			calTable.CopyBaseAttributes(this);
			if(ControlStyleCreated)
				calTable.ApplyStyle(ControlStyle);
			calTable.Width = Width;
			calTable.Height = Height;
			calTable.CellSpacing = CellSpacing;
			calTable.CellPadding = CellPadding;

			if (ControlStyleCreated &&
			    ControlStyle.IsSet (WebControls.Style.BORDERWIDTH) &&
			    BorderWidth != Unit.Empty)
				calTable.BorderWidth = BorderWidth;
			else
				calTable.BorderWidth = Unit.Pixel(1);

			if (ShowGridLines)
				calTable.GridLines = GridLines.Both;
			else
				calTable.GridLines = GridLines.None;
				
#if NET_2_0
			calTable.Caption = Caption;
			calTable.CaptionAlign = CaptionAlign;
#endif

			calTable.RenderBeginTag (writer);

			if (ShowTitle)
				RenderTitle (writer, visDate, SelectionMode, isEnabled);

			if (ShowDayHeader)
				RenderHeader (writer, firstDate, SelectionMode, isEnabled, isHtmlTextWriter);

			RenderAllDays (writer, firstDate, visDate, SelectionMode, isEnabled, isHtmlTextWriter);

			calTable.RenderEndTag(writer);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:59,代码来源:Calendar.cs

示例11: CreateTable

        /*********************************************************************************
        *
        * Calendar rendering methods
        *
        *********************************************************************************/
        //Creates the table for the calendar
        private Table CreateTable(DateTime visibleDate, DateTime firstDay, System.Globalization.Calendar threadCalendar)
        {
            Color defaultColor = ForeColor;
            if (defaultColor == Color.Empty)
            {
                defaultColor = Color.Black;
            }
            defaultButtonColorText = ColorTranslator.ToHtml(defaultColor);

            Table table = new Table();

            if (ID != null)
            {
                table.ID = ClientID;
            }
            table.CopyBaseAttributes(this);
            if (ControlStyleCreated)
            {
                table.ApplyStyle(ControlStyle);
            }
            table.Width = Width;
            table.Height = Height;
            table.CellPadding = CellPadding;
            table.CellSpacing = CellSpacing;

            // default look
            if ((ControlStyleCreated == false) ||
                BorderWidth.Equals(Unit.Empty))
            {
                table.BorderWidth = Unit.Pixel(1);
            }

            if (ShowGridLines)
            {
                table.GridLines = GridLines.Both;
            }
            else
            {
                table.GridLines = GridLines.None;
            }

            bool useAccessibleHeader = UseAccessibleHeader;
            if (useAccessibleHeader)
            {
                if (table.Attributes["title"] == null)
                {
                    table.Attributes["title"] = string.Empty;
                }
            }

            string caption = Caption;
            if (caption.Length > 0)
            {
                table.Caption = caption;
                table.CaptionAlign = CaptionAlign;
            }

            if (ShowTitle)
            {
                table.Rows.Add(CreateTitleRow(visibleDate, threadCalendar));
            }

            if (ShowDayHeader)
            {
                table.Rows.Add(CreateDayHeader(firstDay, visibleDate, threadCalendar));
            }

            return table;
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:75,代码来源:EventCalendar.cs

示例12: Render

        /// <internalonly/>
        /// <devdoc>
        /// <para>Displays the <see cref='System.Web.UI.WebControls.Calendar'/> control on the client.</para>
        /// </devdoc>
        protected internal override void Render(HtmlTextWriter writer) {
            threadCalendar = DateTimeFormatInfo.CurrentInfo.Calendar;
            minSupportedDate = threadCalendar.MinSupportedDateTime;
            maxSupportedDate = threadCalendar.MaxSupportedDateTime;
#if DEBUG
            threadCalendarInitialized = true;
#endif
            DateTime visibleDate = EffectiveVisibleDate();
            DateTime firstDay = FirstCalendarDay(visibleDate);
            CalendarSelectionMode selectionMode = SelectionMode;

            // Make sure we are in a form tag with runat=server.
            if (Page != null) {
                Page.VerifyRenderingInServerForm(this);
            }

            // We only want to display the link if we have a page, or if we are on the design surface
            // If we can stops links being active on the Autoformat dialog, then we can remove this these checks.
            Page page = Page;
            bool buttonsActive;
            if (page == null || DesignMode) {
                buttonsActive = false;
            }
            else {
                buttonsActive = IsEnabled;
            }

            defaultForeColor = ForeColor;
            if (defaultForeColor == Color.Empty) {
                defaultForeColor = DefaultForeColor;
            }
            defaultButtonColorText = ColorTranslator.ToHtml(defaultForeColor);

            Table table = new Table();

            if (ID != null) {
                table.ID = ClientID;
            }
            table.CopyBaseAttributes(this);
            if (ControlStyleCreated) {
                table.ApplyStyle(ControlStyle);
            }
            table.Width = Width;
            table.Height = Height;
            table.CellPadding = CellPadding;
            table.CellSpacing = CellSpacing;

            // default look
            if ((ControlStyleCreated == false) ||
                (ControlStyle.IsSet(System.Web.UI.WebControls.Style.PROP_BORDERWIDTH) == false) ||
                BorderWidth.Equals(Unit.Empty)) {
                table.BorderWidth = Unit.Pixel(1);
            }

            if (ShowGridLines) {
                table.GridLines = GridLines.Both;
            }
            else {
                table.GridLines = GridLines.None;
            }

            bool useAccessibleHeader = UseAccessibleHeader;
            if (useAccessibleHeader) {
                if (table.Attributes["title"] == null) {
                    table.Attributes["title"] = SR.GetString(SR.Calendar_TitleText);
                }
            }

            string caption = Caption;
            if (caption.Length > 0) {
                table.Caption = caption;
                table.CaptionAlign = CaptionAlign;
            }

            table.RenderBeginTag(writer);

            if (ShowTitle) {
                RenderTitle(writer, visibleDate, selectionMode, buttonsActive, useAccessibleHeader);
            }

            if (ShowDayHeader) {
                RenderDayHeader(writer, visibleDate, selectionMode, buttonsActive, useAccessibleHeader);
            }

            RenderDays(writer, firstDay, visibleDate, selectionMode, buttonsActive, useAccessibleHeader);

            table.RenderEndTag(writer);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:92,代码来源:Calendar.cs

示例13: RenderContents

 protected internal override void RenderContents(HtmlTextWriter writer)
 {
     if (this.Controls.Count != 0)
     {
         RepeatInfo info = new RepeatInfo();
         Table table = null;
         Style controlStyle = base.ControlStyle;
         if (this.extractTemplateRows)
         {
             info.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Vertical;
             info.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Flow;
             info.RepeatColumns = 1;
             info.OuterTableImplied = true;
             table = new Table {
                 ID = this.ClientID
             };
             table.CopyBaseAttributes(this);
             table.Caption = this.Caption;
             table.CaptionAlign = this.CaptionAlign;
             table.ApplyStyle(controlStyle);
             table.RenderBeginTag(writer);
         }
         else
         {
             info.RepeatDirection = this.RepeatDirection;
             info.RepeatLayout = this.RepeatLayout;
             info.RepeatColumns = this.RepeatColumns;
             if (info.RepeatLayout == System.Web.UI.WebControls.RepeatLayout.Table)
             {
                 info.Caption = this.Caption;
                 info.CaptionAlign = this.CaptionAlign;
                 info.UseAccessibleHeader = this.UseAccessibleHeader;
             }
             else
             {
                 info.EnableLegacyRendering = base.EnableLegacyRendering;
             }
         }
         info.RenderRepeater(writer, this, controlStyle, this);
         if (table != null)
         {
             table.RenderEndTag(writer);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:45,代码来源:DataList.cs


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