void WriteDay(DateTime date, HtmlTextWriter writer, bool enabled) { TableItemStyle style = new TableItemStyle(); TableCell cell = new TableCell(); CalendarDay day = new CalendarDay(date, IsWeekEnd(date.DayOfWeek), date == TodaysDate, SelectedDates.Contains(date), GetGlobalCalendar().GetMonth(DisplayDate) != GetGlobalCalendar().GetMonth(date), date.Day.ToString()); day.IsSelectable = SelectionMode != CalendarSelectionMode.None; cell.HorizontalAlign = HorizontalAlign.Center; cell.Width = Unit.Percentage(GetCellWidth()); LiteralControl lit = new LiteralControl(day.DayNumberText); cell.Controls.Add(lit); OnDayRender(cell, day); if (dayStyle != null && !dayStyle.IsEmpty) { style.CopyFrom(dayStyle); } if (day.IsWeekend && weekendDayStyle != null && !weekendDayStyle.IsEmpty) { style.CopyFrom(weekendDayStyle); } if (day.IsToday && todayDayStyle != null && !todayDayStyle.IsEmpty) { style.CopyFrom(todayDayStyle); } if (day.IsOtherMonth && otherMonthDayStyle != null && !otherMonthDayStyle.IsEmpty) { style.CopyFrom(otherMonthDayStyle); } if (enabled && day.IsSelected) { style.BackColor = Color.Silver; style.ForeColor = Color.White; if (selectedDayStyle != null && !selectedDayStyle.IsEmpty) { style.CopyFrom(selectedDayStyle); } } cell.ApplyStyle(style); lit.Text = BuildLink(GetDaysFromZenith(date).ToString(), day.DayNumberText, cell.ForeColor, enabled && day.IsSelectable); cell.RenderControl(writer); }
private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here base.GHTTestBegin((HtmlForm)this.FindControl("Form1")); System.Web.UI.WebControls.TableItemStyle tableStyle = new System.Web.UI.WebControls.TableItemStyle(); tableStyle.CopyFrom(Table2.Rows[0].Cells[0].ControlStyle); Table1.Rows[0].Cells[0].ApplyStyle(tableStyle); tableStyle.CopyFrom(Table2.Rows[1].ControlStyle); Table1.Rows[1].ApplyStyle(tableStyle); base.GHTTestEnd(); }
private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here base.GHTTestBegin((HtmlForm)this.FindControl("Form1")); System.Web.UI.WebControls.TableItemStyle tableStyle = new System.Web.UI.WebControls.TableItemStyle(); tableStyle.CopyFrom(Table2.Rows[0].Cells[0].ControlStyle); Table1.Rows[0].Cells[0].ApplyStyle(tableStyle); tableStyle.CopyFrom(Table2.Rows[1].ControlStyle); Table1.Rows[1].ApplyStyle(tableStyle); base.GHTTestEnd(); }
/// <devdoc> /// </devdoc> private void RenderDays(HtmlTextWriter writer, DateTime firstDay, DateTime visibleDate, CalendarSelectionMode selectionMode, bool buttonsActive, bool useAccessibleHeader) { // Now add the rows for the actual days DateTime d = firstDay; TableItemStyle weekSelectorStyle = null; Unit defaultWidth; bool hasWeekSelectors = HasWeekSelectors(selectionMode); if (hasWeekSelectors) { weekSelectorStyle = new TableItemStyle(); weekSelectorStyle.Width = Unit.Percentage(12); weekSelectorStyle.HorizontalAlign = HorizontalAlign.Center; weekSelectorStyle.CopyFrom(SelectorStyle); defaultWidth = Unit.Percentage(12); } else { defaultWidth = Unit.Percentage(14); } // This determines whether we need to call DateTime.ToString for each day. The only culture/calendar // that requires this for now is the HebrewCalendar. bool usesStandardDayDigits = !(threadCalendar is HebrewCalendar); // This determines whether we can write out cells directly, or whether we have to create whole // TableCell objects for each day. bool hasRenderEvent = (this.GetType() != typeof(Calendar) || Events[EventDayRender] != null); TableItemStyle [] cellStyles = new TableItemStyle[16]; int definedStyleMask = GetDefinedStyleMask(); DateTime todaysDate = TodaysDate; string selectWeekText = SelectWeekText; bool daysSelectable = buttonsActive && (selectionMode != CalendarSelectionMode.None); int visibleDateMonth = threadCalendar.GetMonth(visibleDate); int absoluteDay = firstDay.Subtract(baseDate).Days; // VSWhidbey 480155: flag to indicate if forecolor needs to be set // explicitly in design mode to mimic runtime rendering with the // limitation of not supporting CSS class color setting. bool inDesignSelectionMode = (DesignMode && SelectionMode != CalendarSelectionMode.None); //------------------------------------------------------------------ // VSWhidbey 366243: The following variables are for boundary cases // such as the current visible month is the first or the last // supported month. They are used in the 'for' loops below. // For the first supported month, calculate how many days to // skip at the beginning of the first month. E.g. JapaneseCalendar // starts at Sept 8. int numOfFirstDaysToSkip = 0; if (IsMinSupportedYearMonth(visibleDate)) { numOfFirstDaysToSkip = (int)threadCalendar.GetDayOfWeek(firstDay) - NumericFirstDayOfWeek(); // If negative, it simply means the the index of the starting // day name is greater than the day name of the first supported // date. We add back 7 to get the number of days to skip. if (numOfFirstDaysToSkip < 0) { numOfFirstDaysToSkip += 7; } } Debug.Assert(numOfFirstDaysToSkip < 7); // For the last or second last supported month, initialize variables // to identify the last supported date of the current calendar. // e.g. The last supported date of HijriCalendar is April 3. When // the second last monthh is shown, it can be the case that not all // cells will be filled up. bool passedLastSupportedDate = false; DateTime secondLastMonth = threadCalendar.AddMonths(maxSupportedDate, -1); bool lastOrSecondLastMonth = (IsMaxSupportedYearMonth(visibleDate) || IsTheSameYearMonth(secondLastMonth, visibleDate)); //------------------------------------------------------------------ for (int iRow = 0; iRow < 6; iRow++) { if (passedLastSupportedDate) { break; } writer.Write(ROWBEGINTAG); // add week selector column and button if required if (hasWeekSelectors) { // Range selection. The command starts with an "R". The remainder is an integer. When divided by 100 // the result is the day difference from the base date of the first day, and the remainder is the // number of days to select. int dayDiffParameter = (absoluteDay * 100) + 7; // Adjust the dayDiff for the first or the last supported month if (numOfFirstDaysToSkip > 0) { dayDiffParameter -= numOfFirstDaysToSkip; } else if (lastOrSecondLastMonth) { int daysFromLastDate = maxSupportedDate.Subtract(d).Days; if (daysFromLastDate < 6) { dayDiffParameter -= (6 - daysFromLastDate); } } string weekSelectKey = SELECT_RANGE_COMMAND + dayDiffParameter.ToString(CultureInfo.InvariantCulture); string selectWeekTitle = null; if (useAccessibleHeader) { int weekOfMonth = iRow + 1; selectWeekTitle = SR.GetString(SR.Calendar_SelectWeekTitle, weekOfMonth.ToString(CultureInfo.InvariantCulture)); } RenderCalendarCell(writer, weekSelectorStyle, selectWeekText, selectWeekTitle, buttonsActive, weekSelectKey); } for (int iDay = 0; iDay < 7; iDay++) { // Render empty cells for special cases to handle the first // or last supported month. if (numOfFirstDaysToSkip > 0) { iDay += numOfFirstDaysToSkip; for ( ; numOfFirstDaysToSkip > 0; numOfFirstDaysToSkip--) { writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.RenderEndTag(); } } else if (passedLastSupportedDate) { for ( ; iDay < 7; iDay++) { writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.RenderEndTag(); } break; } int dayOfWeek = (int)threadCalendar.GetDayOfWeek(d); int dayOfMonth = threadCalendar.GetDayOfMonth(d); string dayNumberText; if ((dayOfMonth <= cachedNumberMax) && usesStandardDayDigits) { dayNumberText = cachedNumbers[dayOfMonth]; } else { dayNumberText = d.ToString("dd", CultureInfo.CurrentCulture); } CalendarDay day = new CalendarDay(d, (dayOfWeek == 0 || dayOfWeek == 6), // IsWeekend d.Equals(todaysDate), // IsToday (selectedDates != null) && selectedDates.Contains(d), // IsSelected threadCalendar.GetMonth(d) != visibleDateMonth, // IsOtherMonth dayNumberText // Number Text ); int styleMask = STYLEMASK_DAY; if (day.IsSelected) styleMask |= STYLEMASK_SELECTED; if (day.IsOtherMonth) styleMask |= STYLEMASK_OTHERMONTH; if (day.IsToday) styleMask |= STYLEMASK_TODAY; if (day.IsWeekend) styleMask |= STYLEMASK_WEEKEND; int dayStyleMask = definedStyleMask & styleMask; // determine the unique portion of the mask for the current calendar, // which will strip out the day style bit int dayStyleID = dayStyleMask & STYLEMASK_UNIQUE; TableItemStyle cellStyle = cellStyles[dayStyleID]; if (cellStyle == null) { cellStyle = new TableItemStyle(); SetDayStyles(cellStyle, dayStyleMask, defaultWidth); cellStyles[dayStyleID] = cellStyle; } string dayTitle = null; if (useAccessibleHeader) { dayTitle = d.ToString("m", CultureInfo.CurrentCulture); } if (hasRenderEvent) { TableCell cdc = new TableCell(); cdc.ApplyStyle(cellStyle); LiteralControl dayContent = new LiteralControl(dayNumberText); cdc.Controls.Add(dayContent); day.IsSelectable = daysSelectable; OnDayRender(cdc, day); // refresh the day content dayContent.Text = GetCalendarButtonText(absoluteDay.ToString(CultureInfo.InvariantCulture), dayNumberText, dayTitle, buttonsActive && day.IsSelectable, cdc.ForeColor); cdc.RenderControl(writer); } else { // VSWhidbey 480155: In design mode we render days as // texts instead of links so CSS class color setting is // supported. But this differs in runtime rendering // where CSS class color setting is not supported. To // correctly mimic the forecolor of runtime rendering in // design time, the default color, which is used in // runtime rendering, is explicitly set in this case. if (inDesignSelectionMode && cellStyle.ForeColor.IsEmpty) { cellStyle.ForeColor = defaultForeColor; } RenderCalendarCell(writer, cellStyle, dayNumberText, dayTitle, daysSelectable, absoluteDay.ToString(CultureInfo.InvariantCulture)); } Debug.Assert(!passedLastSupportedDate); if (lastOrSecondLastMonth && d.Month == maxSupportedDate.Month && d.Day == maxSupportedDate.Day) { passedLastSupportedDate = true; } else { d = threadCalendar.AddDays(d, 1); absoluteDay++; } } writer.Write(ROWENDTAG); } }
/// <summary> /// Prepares our composite controls for rendering by setting /// last-minute (ie: non-viewstate tracked) properties. /// </summary> protected virtual void PrepareControlHierarchy() { if (Controls.Count > 0) { // Setup base table control style Table table = (Table)Controls[0]; table.CopyBaseAttributes(this); if (ControlStyleCreated && !ControlStyle.IsEmpty) { table.ApplyStyle(ControlStyle); } else { table.GridLines = GridLines.None; table.CellPadding = 10; table.CellSpacing = 0; } // Setup label controls. TableRow labelRowTop = (TableRow)FindControl("labelRowTop"); TableRow labelRowBottom = (TableRow)FindControl("labelRowBottom"); labelRowTop.Visible = false; labelRowBottom.Visible = false; if (ShowLabel) { // Setup label row style TableItemStyle style = new TableItemStyle(); style.CopyFrom(LabelRowStyle); style.HorizontalAlign = LabelHorizontalAlign; // Setup appropriate row if (LabelVerticalAlign == VerticalAlign.Top) { labelRowTop.MergeStyle(style); labelRowTop.Visible = true; TableCell labelCell = (TableCell)FindControl("labelCellTop"); labelCell.Text = Text; } else { labelRowBottom.MergeStyle(style); labelRowBottom.Visible = true; TableCell labelCell = (TableCell)FindControl("labelCellBottom"); labelCell.Text = Text; } } // Setup barcode row style TableRow barcodeRow = (TableRow)FindControl("barcodeRow"); barcodeRow.MergeStyle(BarcodeRowStyle); // Setup barcode image url BarcodeImageUriBuilder builder = new BarcodeImageUriBuilder(); builder.Text = Text; builder.Scale = Scale; builder.EncodingScheme = BarcodeEncoding; builder.BarMinHeight = BarMinHeight; builder.BarMaxHeight = BarMaxHeight; builder.BarMinWidth = BarMinWidth; builder.BarMaxWidth = BarMaxWidth; Image barcodeImage = (Image)FindControl("barcodeImage"); barcodeImage.ImageUrl = builder.ToString(); } }
void WriteDay (DateTime date, HtmlTextWriter writer) { TableItemStyle style = new TableItemStyle (); TableCell cell = new TableCell (); CalendarDay day = new CalendarDay (date, IsWeekEnd (date.DayOfWeek), date == TodaysDate, SelectedDates.Contains (date), GetGlobalCalendar ().GetMonth (DisplayDate) != GetGlobalCalendar ().GetMonth (date), date.Day.ToString ()); day.IsSelectable = SelectionMode != CalendarSelectionMode.None; cell.HorizontalAlign = HorizontalAlign.Center; cell.Width = Unit.Percentage (GetCellWidth ()); LiteralControl lit = new LiteralControl (day.DayNumberText); cell.Controls.Add (lit); OnDayRender (cell, day); if (dayStyle != null && !dayStyle.IsEmpty) { style.CopyFrom (dayStyle); } if (day.IsWeekend && weekendDayStyle != null && !weekendDayStyle.IsEmpty) { style.CopyFrom (weekendDayStyle); } if (day.IsToday && todayDayStyle != null && !todayDayStyle.IsEmpty) { style.CopyFrom (todayDayStyle); } if (day.IsOtherMonth && otherMonthDayStyle != null && !otherMonthDayStyle.IsEmpty) { style.CopyFrom (otherMonthDayStyle); } if (day.IsSelected && Enabled) { style.BackColor = Color.Silver; style.ForeColor = Color.White; if (selectedDayStyle != null && !selectedDayStyle.IsEmpty) { style.CopyFrom (selectedDayStyle); } } cell.ApplyStyle (style); lit.Text = BuildLink (GetDaysFromZenith (date).ToString (), day.DayNumberText, cell.ForeColor, day.IsSelectable && Enabled); cell.RenderControl (writer); }
private void ApplyCompleteValues() { LoginUtil.ApplyStyleToLiteral(this._completeStepContainer.SuccessTextLabel, this.CompleteSuccessText, this._completeSuccessTextStyle, true); switch (this.ContinueButtonType) { case ButtonType.Button: this._completeStepContainer.ContinueLinkButton.Visible = false; this._completeStepContainer.ContinueImageButton.Visible = false; this._completeStepContainer.ContinuePushButton.Text = this.ContinueButtonText; this._completeStepContainer.ContinuePushButton.ValidationGroup = this.ValidationGroup; this._completeStepContainer.ContinuePushButton.TabIndex = this.TabIndex; this._completeStepContainer.ContinuePushButton.AccessKey = this.AccessKey; break; case ButtonType.Image: this._completeStepContainer.ContinueLinkButton.Visible = false; this._completeStepContainer.ContinuePushButton.Visible = false; this._completeStepContainer.ContinueImageButton.ImageUrl = this.ContinueButtonImageUrl; this._completeStepContainer.ContinueImageButton.AlternateText = this.ContinueButtonText; this._completeStepContainer.ContinueImageButton.ValidationGroup = this.ValidationGroup; this._completeStepContainer.ContinueImageButton.TabIndex = this.TabIndex; this._completeStepContainer.ContinueImageButton.AccessKey = this.AccessKey; break; case ButtonType.Link: this._completeStepContainer.ContinuePushButton.Visible = false; this._completeStepContainer.ContinueImageButton.Visible = false; this._completeStepContainer.ContinueLinkButton.Text = this.ContinueButtonText; this._completeStepContainer.ContinueLinkButton.ValidationGroup = this.ValidationGroup; this._completeStepContainer.ContinueLinkButton.TabIndex = this.TabIndex; this._completeStepContainer.ContinueLinkButton.AccessKey = this.AccessKey; break; } if (!base.NavigationButtonStyle.IsEmpty) { this._completeStepContainer.ContinuePushButton.ApplyStyle(base.NavigationButtonStyle); this._completeStepContainer.ContinueImageButton.ApplyStyle(base.NavigationButtonStyle); this._completeStepContainer.ContinueLinkButton.ApplyStyle(base.NavigationButtonStyle); } if (this._continueButtonStyle != null) { this._completeStepContainer.ContinuePushButton.ApplyStyle(this._continueButtonStyle); this._completeStepContainer.ContinueImageButton.ApplyStyle(this._continueButtonStyle); this._completeStepContainer.ContinueLinkButton.ApplyStyle(this._continueButtonStyle); } LoginUtil.ApplyStyleToLiteral(this._completeStepContainer.Title, this.CompleteStep.Title, this._titleTextStyle, true); string editProfileText = this.EditProfileText; bool flag = editProfileText.Length > 0; HyperLink editProfileLink = this._completeStepContainer.EditProfileLink; editProfileLink.Visible = flag; if (flag) { editProfileLink.Text = editProfileText; editProfileLink.NavigateUrl = this.EditProfileUrl; editProfileLink.TabIndex = this.TabIndex; if (this._hyperLinkStyle != null) { Style style = new TableItemStyle(); style.CopyFrom(this._hyperLinkStyle); style.Font.Reset(); LoginUtil.SetTableCellStyle(editProfileLink, style); editProfileLink.Font.CopyFrom(this._hyperLinkStyle.Font); editProfileLink.ForeColor = this._hyperLinkStyle.ForeColor; } } string editProfileIconUrl = this.EditProfileIconUrl; bool flag2 = editProfileIconUrl.Length > 0; Image editProfileIcon = this._completeStepContainer.EditProfileIcon; editProfileIcon.Visible = flag2; if (flag2) { editProfileIcon.ImageUrl = editProfileIconUrl; editProfileIcon.AlternateText = this.EditProfileText; } LoginUtil.SetTableCellVisible(editProfileLink, flag || flag2); Table layoutTable = ((CompleteStepContainer) this.CompleteStep.ContentTemplateContainer).LayoutTable; layoutTable.Height = this.Height; layoutTable.Width = this.Width; }
/// <internalonly/> /// <devdoc> /// </devdoc> protected internal override void PrepareControlHierarchy() { if (Controls.Count == 0) return; Table childTable = (Table)Controls[0]; childTable.CopyBaseAttributes(this); childTable.Caption = Caption; childTable.CaptionAlign = CaptionAlign; if (ControlStyleCreated) { childTable.ApplyStyle(ControlStyle); } else { // Since we didn't create a ControlStyle yet, the default // settings for the default style of the control need to be applied // to the child table control directly // childTable.GridLines = GridLines.Both; childTable.CellSpacing = 0; } TableRowCollection rows = childTable.Rows; int rowCount = rows.Count; if (rowCount == 0) return; int columnCount = Columns.Count; DataGridColumn[] definedColumns = new DataGridColumn[columnCount]; if (columnCount > 0) Columns.CopyTo(definedColumns, 0); // the composite alternating item style, so we need to do just one // merge style on the actual item Style altItemStyle = null; if (alternatingItemStyle != null) { altItemStyle = new TableItemStyle(); altItemStyle.CopyFrom(itemStyle); altItemStyle.CopyFrom(alternatingItemStyle); } else { altItemStyle = itemStyle; } int visibleColumns = 0; bool calculateColumns = true; for (int i = 0; i < rowCount; i++) { DataGridItem item = (DataGridItem)rows[i]; switch (item.ItemType) { case ListItemType.Header: if (ShowHeader == false) { item.Visible = false; continue; // with the next row } else { if (headerStyle != null) { item.MergeStyle(headerStyle); } } break; case ListItemType.Footer: if (ShowFooter == false) { item.Visible = false; continue; // with the next row } else { item.MergeStyle(footerStyle); } break; case ListItemType.Pager: if (pagerStyle.Visible == false) { item.Visible = false; continue; // with the next row } else { if (i == 0) { // top pager if (pagerStyle.IsPagerOnTop == false) { item.Visible = false; continue; } } else { // bottom pager if (pagerStyle.IsPagerOnBottom == false) { item.Visible = false; continue; } } item.MergeStyle(pagerStyle); } break; case ListItemType.Item: item.MergeStyle(itemStyle); break; case ListItemType.AlternatingItem: item.MergeStyle(altItemStyle); break; case ListItemType.SelectedItem: // When creating the control hierarchy we first check if the // item is in edit mode, so we know this item cannot be in edit // mode. The only special characteristic of this item is that // it is selected. { Style s = new TableItemStyle(); if (item.ItemIndex % 2 != 0) s.CopyFrom(altItemStyle); else s.CopyFrom(itemStyle); s.CopyFrom(selectedItemStyle); item.MergeStyle(s); } break; case ListItemType.EditItem: // When creating the control hierarchy, we first check if the // item is in edit mode. So an item may be selected too, and // so both editItemStyle (more specific) and selectedItemStyle // are applied. { Style s = new TableItemStyle(); if (item.ItemIndex % 2 != 0) s.CopyFrom(altItemStyle); else s.CopyFrom(itemStyle); if (item.ItemIndex == SelectedIndex) s.CopyFrom(selectedItemStyle); s.CopyFrom(editItemStyle); item.MergeStyle(s); } break; } TableCellCollection cells = item.Cells; int cellCount = cells.Count; if ((columnCount > 0) && (item.ItemType != ListItemType.Pager)) { int definedCells = cellCount; if (columnCount < cellCount) definedCells = columnCount; for (int j = 0; j < definedCells; j++) { if (definedColumns[j].Visible == false) { cells[j].Visible = false; } else { if (item.ItemType == ListItemType.Item && calculateColumns) { visibleColumns++; } Style cellStyle = null; switch (item.ItemType) { case ListItemType.Header: cellStyle = definedColumns[j].HeaderStyleInternal; break; case ListItemType.Footer: cellStyle = definedColumns[j].FooterStyleInternal; break; default: cellStyle = definedColumns[j].ItemStyleInternal; break; } cells[j].MergeStyle(cellStyle); } } if (item.ItemType == ListItemType.Item) { calculateColumns = false; } } } if (Items.Count > 0 && visibleColumns != Items[0].Cells.Count && AllowPaging) { for (int i = 0; i < rowCount; i++) { DataGridItem item = (DataGridItem)rows[i]; if (item.ItemType == ListItemType.Pager && item.Cells.Count > 0) { item.Cells[0].ColumnSpan = visibleColumns; } } } }
/// <devdoc> /// </devdoc> private void SetDayStyles(TableItemStyle style, int styleMask, Unit defaultWidth) { // default day styles style.Width = defaultWidth; style.HorizontalAlign = HorizontalAlign.Center; if ((styleMask & STYLEMASK_DAY) != 0) { style.CopyFrom(DayStyle); } if ((styleMask & STYLEMASK_WEEKEND) != 0) { style.CopyFrom(WeekendDayStyle); } if ((styleMask & STYLEMASK_OTHERMONTH) != 0) { style.CopyFrom(OtherMonthDayStyle); } if ((styleMask & STYLEMASK_TODAY) != 0) { style.CopyFrom(TodayDayStyle); } if ((styleMask & STYLEMASK_SELECTED) != 0) { // default selected day style style.ForeColor = Color.White; style.BackColor = Color.Silver; style.CopyFrom(SelectedDayStyle); } }
/// <internalonly/> /// <devdoc> /// </devdoc> protected internal virtual void PrepareControlHierarchy() { if (Controls.Count == 0) return; bool controlStyleCreated = ControlStyleCreated; Table childTable = (Table)Controls[0]; childTable.CopyBaseAttributes(this); if (controlStyleCreated && !ControlStyle.IsEmpty) { childTable.ApplyStyle(ControlStyle); } else { // Since we didn't create a ControlStyle yet, the default // settings for the default style of the control need to be applied // to the child table control directly // childTable.GridLines = GridLines.Both; childTable.CellSpacing = 0; } childTable.Caption = Caption; childTable.CaptionAlign = CaptionAlign; TableRowCollection rows = childTable.Rows; // the composite alternating row style, so we need to do just one // merge style on the actual row Style altRowStyle = null; if (_alternatingRowStyle != null) { altRowStyle = new TableItemStyle(); altRowStyle.CopyFrom(_rowStyle); altRowStyle.CopyFrom(_alternatingRowStyle); } else { altRowStyle = _rowStyle; } int visibleColumns = 0; bool calculateColumns = true; foreach (GridViewRow row in rows) { switch (row.RowType) { case DataControlRowType.Header: if (ShowHeader && _headerStyle != null) { row.MergeStyle(_headerStyle); } break; case DataControlRowType.Footer: if (ShowFooter && _footerStyle != null) { row.MergeStyle(_footerStyle); } break; case DataControlRowType.Pager: if (row.Visible && _pagerStyle != null) { row.MergeStyle(_pagerStyle); } break; case DataControlRowType.DataRow: if ((row.RowState & DataControlRowState.Edit) != 0) { // When creating the control hierarchy, we first check if the // row is in edit mode. So an row may be selected too, and // so both editRowStyle (more specific) and selectedRowStyle // are applied. { Style s = new TableItemStyle(); if (row.RowIndex % 2 != 0) s.CopyFrom(altRowStyle); else s.CopyFrom(_rowStyle); if (row.RowIndex == SelectedIndex) s.CopyFrom(_selectedRowStyle); s.CopyFrom(_editRowStyle); row.MergeStyle(s); } } else if ((row.RowState & DataControlRowState.Selected) != 0) { // When creating the control hierarchy we first check if the // row is in edit mode, so we know this row cannot be in edit // mode. The only special characteristic of this row is that // it is selected. { Style s = new TableItemStyle(); if (row.RowIndex % 2 != 0) s.CopyFrom(altRowStyle); else s.CopyFrom(_rowStyle); s.CopyFrom(_selectedRowStyle); row.MergeStyle(s); } } else if ((row.RowState & DataControlRowState.Alternate) != 0) { row.MergeStyle(altRowStyle); } else { row.MergeStyle(_rowStyle); } break; case DataControlRowType.EmptyDataRow: row.MergeStyle(_emptyDataRowStyle); break; } // Apply the sorting style if the row is not selected or the row is selected and there was no specified SelectedRowStyle bool applyCellSortingStyles = (row.RowState & DataControlRowState.Selected) == 0 || ((row.RowState & DataControlRowState.Selected) != 0 && _selectedRowStyle == null); if ((row.RowType != DataControlRowType.Pager) && (row.RowType != DataControlRowType.EmptyDataRow)) { foreach (TableCell cell in row.Cells) { DataControlFieldCell fieldCell = cell as DataControlFieldCell; if (fieldCell != null) { DataControlField field = fieldCell.ContainingField; if (field != null) { if (field.Visible == false) { cell.Visible = false; } else { if (row.RowType == DataControlRowType.DataRow && calculateColumns) { visibleColumns++; } Style cellStyle = null; switch (row.RowType) { case DataControlRowType.Header: cellStyle = field.HeaderStyleInternal; ApplySortingStyle(cell, field, _sortedAscendingHeaderStyle, _sortedDescendingHeaderStyle); break; case DataControlRowType.Footer: cellStyle = field.FooterStyleInternal; break; case DataControlRowType.DataRow: cellStyle = field.ItemStyleInternal; if (applyCellSortingStyles) { ApplySortingStyle(cell, field, _sortedAscendingCellStyle, _sortedDescendingCellStyle); } break; default: cellStyle = field.ItemStyleInternal; break; } if (cellStyle != null) { cell.MergeStyle(cellStyle); } if (row.RowType == DataControlRowType.DataRow) { foreach (Control control in cell.Controls) { WebControl webControl = control as WebControl; Style fieldControlStyle = field.ControlStyleInternal; if (webControl != null && fieldControlStyle != null && !fieldControlStyle.IsEmpty) { webControl.ControlStyle.CopyFrom(fieldControlStyle); } } } } } } } if (row.RowType == DataControlRowType.DataRow) { calculateColumns = false; } } } if (Rows.Count > 0 && visibleColumns != Rows[0].Cells.Count) { if (_topPagerRow != null && _topPagerRow.Cells.Count > 0) { _topPagerRow.Cells[0].ColumnSpan = visibleColumns; } if (_bottomPagerRow != null && _bottomPagerRow.Cells.Count > 0) { _bottomPagerRow.Cells[0].ColumnSpan = visibleColumns; } } }
/// <internalonly/> /// <devdoc> /// </devdoc> protected internal override void PrepareControlHierarchy() { ControlCollection controls = Controls; int controlCount = controls.Count; if (controlCount == 0) return; // the composite alternating item style, so we need to do just one // merge style on the actual item Style altItemStyle = null; if (alternatingItemStyle != null) { altItemStyle = new TableItemStyle(); altItemStyle.CopyFrom(itemStyle); altItemStyle.CopyFrom(alternatingItemStyle); } else { altItemStyle = itemStyle; } Style compositeStyle; for (int i = 0; i < controlCount; i++) { DataListItem item = (DataListItem)controls[i]; compositeStyle = null; switch (item.ItemType) { case ListItemType.Header: if (ShowHeader) compositeStyle = headerStyle; break; case ListItemType.Footer: if (ShowFooter) compositeStyle = footerStyle; break; case ListItemType.Separator: compositeStyle = separatorStyle; break; case ListItemType.Item: compositeStyle = itemStyle; break; case ListItemType.AlternatingItem: compositeStyle = altItemStyle; break; case ListItemType.SelectedItem: // When creating the control hierarchy we first check if the // item is in edit mode, so we know this item cannot be in edit // mode. The only special characteristic of this item is that // it is selected. { compositeStyle = new TableItemStyle(); if (item.ItemIndex % 2 != 0) compositeStyle.CopyFrom(altItemStyle); else compositeStyle.CopyFrom(itemStyle); compositeStyle.CopyFrom(selectedItemStyle); } break; case ListItemType.EditItem: // When creating the control hierarchy, we first check if the // item is in edit mode. So an item may be selected too, and // so both editItemStyle (more specific) and selectedItemStyle // are applied. { compositeStyle = new TableItemStyle(); if (item.ItemIndex % 2 != 0) compositeStyle.CopyFrom(altItemStyle); else compositeStyle.CopyFrom(itemStyle); if (item.ItemIndex == SelectedIndex) compositeStyle.CopyFrom(selectedItemStyle); compositeStyle.CopyFrom(editItemStyle); } break; } if (compositeStyle != null) { // use the cached value of ExtractTemplateRows as it was at the time of // control creation, so we don't do the wrong thing even if the // user happened to change the property if (extractTemplateRows == false) { item.MergeStyle(compositeStyle); } else { // apply the style on the TRs IEnumerator controlEnum = item.Controls.GetEnumerator(); while (controlEnum.MoveNext()) { Control c = (Control)controlEnum.Current; if (c is Table) { IEnumerator rowEnum = ((Table)c).Rows.GetEnumerator(); while (rowEnum.MoveNext()) { // ((TableRow)rowEnum.Current).MergeStyle(compositeStyle); } break; } } } } } }
private void RenderAllDays (HtmlTextWriter writer, DateTime firstDay, DateTime activeDate, CalendarSelectionMode mode, bool isActive, bool isDownLevel) { TableItemStyle weeksStyle = null; TableCell weeksCell = new TableCell (); TableItemStyle weekendStyle = WeekendDayStyle; TableItemStyle otherMonthStyle = OtherMonthDayStyle; Unit size; bool isWeekMode = (mode == CalendarSelectionMode.DayWeek || mode == CalendarSelectionMode.DayWeekMonth); if (isWeekMode) { weeksStyle = new TableItemStyle (); weeksStyle.Width = Unit.Percentage (12); weeksStyle.HorizontalAlign = HorizontalAlign.Center; weeksStyle.CopyFrom (SelectorStyle); size = Unit.Percentage (12); } else { size = Unit.Percentage (14); } TableItemStyle [] styles = new TableItemStyle [32]; int definedStyles = MASK_SELECTED; if (weekendStyle != null && !weekendStyle.IsEmpty) definedStyles |= MASK_WEEKEND; if (otherMonthStyle != null && !otherMonthStyle.IsEmpty) definedStyles |= MASK_OMONTH; if (todayDayStyle != null && !todayDayStyle.IsEmpty) definedStyles |= MASK_TODAY; if (dayStyle != null && !dayStyle.IsEmpty) definedStyles |= MASK_DAY; int month = globCal.GetMonth (activeDate); DateTime currentDay = firstDay; int begin = (int) (firstDay - begin_date).TotalDays; for (int crr = 0; crr < 6; crr++) { writer.Write ("<tr>"); if (isWeekMode) { int week_offset = begin + crr * 7; string cellText = GetCalendarLinkText ( "R" + week_offset + "07", SelectWeekText, "Select week " + (crr + 1), weeksCell.ForeColor, isActive); weeksCell.Text = cellText; weeksCell.ApplyStyle (weeksStyle); RenderCalendarCell (writer, weeksCell, cellText); } for (int weekDay = 0; weekDay < 7; weekDay++) { string dayString = currentDay.Day.ToString (); DayOfWeek dow = currentDay.DayOfWeek; CalendarDay calDay = new CalendarDay ( currentDay, dow == DayOfWeek.Sunday || dow == DayOfWeek.Saturday, currentDay == TodaysDate, SelectedDates.Contains (currentDay), globCal.GetMonth (currentDay) != month, dayString ); int dayStyles = GetMask (calDay) & definedStyles; TableItemStyle currentDayStyle = styles [dayStyles]; if (currentDayStyle == null) { currentDayStyle = new TableItemStyle (); if ((dayStyles & MASK_DAY) != 0) currentDayStyle.CopyFrom (DayStyle); if ((dayStyles & MASK_WEEKEND) != 0) currentDayStyle.CopyFrom (WeekendDayStyle); if ((dayStyles & MASK_TODAY) != 0) currentDayStyle.CopyFrom (TodayDayStyle); if ((dayStyles & MASK_OMONTH) != 0) currentDayStyle.CopyFrom (OtherMonthDayStyle); if ((dayStyles & MASK_SELECTED) != 0) { currentDayStyle.ForeColor = Color.White; currentDayStyle.BackColor = Color.Silver; currentDayStyle.CopyFrom (SelectedDayStyle); } currentDayStyle.Width = size; currentDayStyle.HorizontalAlign = HorizontalAlign.Center; } TableCell dayCell = new TableCell (); dayCell.ApplyStyle (currentDayStyle); LiteralControl number = new LiteralControl (dayString); dayCell.Controls.Add (number); calDay.IsSelectable = isActive; OnDayRender (dayCell, calDay); if (calDay.IsSelectable) number.Text = GetCalendarLinkText ((begin + (crr * 7 + weekDay)).ToString (), dayString, currentDay.ToShortDateString (), dayCell.ForeColor, isActive); dayCell.RenderControl (writer); currentDay = globCal.AddDays (currentDay, 1); } writer.Write("</tr>"); } }
protected internal override void PrepareControlHierarchy() { if (this.Controls.Count != 0) { Table table = (Table) this.Controls[0]; table.CopyBaseAttributes(this); table.Caption = this.Caption; table.CaptionAlign = this.CaptionAlign; if (base.ControlStyleCreated) { table.ApplyStyle(base.ControlStyle); } else { table.GridLines = GridLines.Both; table.CellSpacing = 0; } TableRowCollection rows = table.Rows; int count = rows.Count; if (count != 0) { int num2 = this.Columns.Count; DataGridColumn[] array = new DataGridColumn[num2]; if (num2 > 0) { this.Columns.CopyTo(array, 0); } Style s = null; if (this.alternatingItemStyle != null) { s = new TableItemStyle(); s.CopyFrom(this.itemStyle); s.CopyFrom(this.alternatingItemStyle); } else { s = this.itemStyle; } int num3 = 0; bool flag = true; for (int i = 0; i < count; i++) { Style style2; Style style3; TableCellCollection cells; DataGridItem item = (DataGridItem) rows[i]; switch (item.ItemType) { case ListItemType.Header: { if (this.ShowHeader) { break; } item.Visible = false; continue; } case ListItemType.Footer: { if (this.ShowFooter) { goto Label_016A; } item.Visible = false; continue; } case ListItemType.Item: item.MergeStyle(this.itemStyle); goto Label_029E; case ListItemType.AlternatingItem: item.MergeStyle(s); goto Label_029E; case ListItemType.SelectedItem: style2 = new TableItemStyle(); if ((item.ItemIndex % 2) == 0) { goto Label_021D; } style2.CopyFrom(s); goto Label_022A; case ListItemType.EditItem: style3 = new TableItemStyle(); if ((item.ItemIndex % 2) == 0) { goto Label_025F; } style3.CopyFrom(s); goto Label_026C; case ListItemType.Pager: { if (this.pagerStyle.Visible) { goto Label_0196; } item.Visible = false; continue; } default: goto Label_029E; } if (this.headerStyle != null) { item.MergeStyle(this.headerStyle); } goto Label_029E; Label_016A: item.MergeStyle(this.footerStyle); goto Label_029E; Label_0196: if (i == 0) { if (this.pagerStyle.IsPagerOnTop) { goto Label_01CE; } item.Visible = false; continue; } if (!this.pagerStyle.IsPagerOnBottom) { item.Visible = false; continue; } Label_01CE: item.MergeStyle(this.pagerStyle); goto Label_029E; Label_021D: style2.CopyFrom(this.itemStyle); Label_022A: style2.CopyFrom(this.selectedItemStyle); item.MergeStyle(style2); goto Label_029E; Label_025F: style3.CopyFrom(this.itemStyle); Label_026C: if (item.ItemIndex == this.SelectedIndex) { style3.CopyFrom(this.selectedItemStyle); } style3.CopyFrom(this.editItemStyle); item.MergeStyle(style3); Label_029E: cells = item.Cells; int num5 = cells.Count; if ((num2 > 0) && (item.ItemType != ListItemType.Pager)) { int num6 = num5; if (num2 < num5) { num6 = num2; } for (int j = 0; j < num6; j++) { if (!array[j].Visible) { cells[j].Visible = false; continue; } if ((item.ItemType == ListItemType.Item) && flag) { num3++; } Style headerStyleInternal = null; switch (item.ItemType) { case ListItemType.Header: headerStyleInternal = array[j].HeaderStyleInternal; break; case ListItemType.Footer: headerStyleInternal = array[j].FooterStyleInternal; break; default: headerStyleInternal = array[j].ItemStyleInternal; break; } cells[j].MergeStyle(headerStyleInternal); } if (item.ItemType == ListItemType.Item) { flag = false; } } } if (((this.Items.Count > 0) && (num3 != this.Items[0].Cells.Count)) && this.AllowPaging) { for (int k = 0; k < count; k++) { DataGridItem item2 = (DataGridItem) rows[k]; if ((item2.ItemType == ListItemType.Pager) && (item2.Cells.Count > 0)) { item2.Cells[0].ColumnSpan = num3; } } } } } }
private TableRow CreateDayHeader(DateTime firstDay, DateTime visibleDate, System.Globalization.Calendar threadCalendar) { TableRow row = new TableRow(); DateTimeFormatInfo dtf = DateTimeFormatInfo.CurrentInfo; TableItemStyle dayNameStyle = new TableItemStyle(); dayNameStyle.HorizontalAlign = HorizontalAlign.Center; dayNameStyle.CopyFrom(DayHeaderStyle); DayNameFormat dayNameFormat = DayNameFormat; int numericFirstDay = (int)threadCalendar.GetDayOfWeek(firstDay); for (int i = numericFirstDay; i < numericFirstDay + 7; i++) { string dayName; int dayOfWeek = i % 7; switch (dayNameFormat) { case DayNameFormat.FirstLetter: dayName = dtf.GetDayName((DayOfWeek)dayOfWeek).Substring(0, 1); break; case DayNameFormat.FirstTwoLetters: dayName = dtf.GetDayName((DayOfWeek)dayOfWeek).Substring(0, 2); break; case DayNameFormat.Full: dayName = dtf.GetDayName((DayOfWeek)dayOfWeek); break; case DayNameFormat.Short: dayName = dtf.GetAbbreviatedDayName((DayOfWeek)dayOfWeek); break; case DayNameFormat.Shortest: dayName = dtf.GetShortestDayName((DayOfWeek)dayOfWeek); break; default: System.Diagnostics.Debug.Assert(false, "Unknown DayNameFormat value!"); goto case DayNameFormat.Short; } TableCell cell = new TableCell(); cell.ApplyStyle(dayNameStyle); cell.Text = dayName; row.Cells.Add(cell); } return row; }
private void SetDayStyles(TableItemStyle style, int styleMask, Unit defaultWidth) { // default day styles style.Width = defaultWidth; style.HorizontalAlign = HorizontalAlign.Center; if ((styleMask & STYLEMASK_DAY) != 0) { style.CopyFrom(DayStyle); } if ((styleMask & STYLEMASK_WEEKEND) != 0) { style.CopyFrom(WeekendDayStyle); } if ((styleMask & STYLEMASK_OTHERMONTH) != 0) { style.CopyFrom(OtherMonthDayStyle); } if ((styleMask & STYLEMASK_TODAY) != 0) { style.CopyFrom(TodayDayStyle); } }
public void CopyFrom () { TableItemStyle tis = new TableItemStyle (); tis.HorizontalAlign = HorizontalAlign.Left; tis.VerticalAlign = VerticalAlign.Top; tis.Wrap = true; tis.CopyFrom (GetTableItemStyle ()); CheckTableStyle (tis); }
protected override void PrepareControlHierarchy() { if (Controls.Count == 0) return; Table display = (Table) Controls [0]; display.CopyBaseAttributes (this); if (ControlStyleCreated) { display.ApplyStyle (ControlStyle); } else { display.GridLines = GridLines.Both; display.CellSpacing = 0; } TableRowCollection rows = display.Rows; if (rows.Count == 0) return; int nCols = Columns.Count; DataGridColumn [] cols = new DataGridColumn [nCols]; Style deployStyle = null; if (nCols > 0) Columns.CopyTo (cols, 0); if (alternatingItemStyle != null) { deployStyle = new TableItemStyle (); deployStyle.CopyFrom (itemStyle); deployStyle.CopyFrom (alternatingItemStyle); } else { deployStyle = itemStyle; } int nrows = rows.Count; for (int counter = 0; counter < nrows; counter++) PrepareControlHierarchyForItem (cols, (DataGridItem) rows [counter], counter, deployStyle); }
/// <summary> /// Undocumented /// </summary> protected override void PrepareControlHierarchy () { if (Controls.Count == 0) return; Style defaultStyle = null; Style rowStyle = null; if (alternatingItemStyle != null) { defaultStyle = new TableItemStyle (); defaultStyle.CopyFrom (itemStyle); defaultStyle.CopyFrom (alternatingItemStyle); } else { defaultStyle = itemStyle; } foreach (DataListItem current in Controls) { rowStyle = null; switch (current.ItemType) { case ListItemType.Header: if (headerStyle != null) rowStyle = headerStyle; break; case ListItemType.Footer: if (footerStyle != null) rowStyle = footerStyle; break; case ListItemType.Separator: rowStyle = separatorStyle; break; case ListItemType.Item: rowStyle = itemStyle; break; case ListItemType.AlternatingItem: rowStyle = defaultStyle; break; case ListItemType.SelectedItem: rowStyle = new TableItemStyle (); if ((current.ItemIndex % 2) == 0) { rowStyle.CopyFrom (itemStyle); } else { rowStyle.CopyFrom (defaultStyle); } rowStyle.CopyFrom (selectedItemStyle); break; case ListItemType.EditItem: rowStyle = new TableItemStyle (); if ((current.ItemIndex % 2) == 0) { rowStyle.CopyFrom (itemStyle); } else { rowStyle.CopyFrom (defaultStyle); } if (current.ItemIndex == SelectedIndex) rowStyle.CopyFrom (selectedItemStyle); rowStyle.CopyFrom (editItemStyle); break; } if (rowStyle == null) continue; if (!extractTemplateRows) { current.MergeStyle (rowStyle); continue; } if (current.HasControls ()) { int len = current.Controls.Count; for (int i = 0 ; i < len ; i++) { Control currentCtrl = current.Controls [i]; if (!(currentCtrl is Table)) continue; foreach (TableRow cRow in ((Table) currentCtrl).Rows) cRow.MergeStyle (rowStyle); } } } }
private void PrepareControlHierarchyForItem (DataGridColumn [] cols, DataGridItem item, int index, Style deployStyle) { switch (item.ItemType) { case ListItemType.Header: if (!ShowHeader) { item.Visible = false; break; } if (headerStyle != null) item.MergeStyle (headerStyle); goto case ListItemType.Separator; case ListItemType.Footer: if (!ShowFooter) { item.Visible = false; break; } if (footerStyle != null) item.MergeStyle (footerStyle); goto case ListItemType.Separator; case ListItemType.Item : item.MergeStyle (itemStyle); goto case ListItemType.Separator; case ListItemType.AlternatingItem: item.MergeStyle (deployStyle); goto case ListItemType.Separator; case ListItemType.SelectedItem: Style selStyle = new TableItemStyle (); if ((item.ItemIndex % 2) == 0) { selStyle.CopyFrom (itemStyle); } else { selStyle.CopyFrom (deployStyle); } selStyle.CopyFrom (selectedItemStyle); item.MergeStyle (selStyle); goto case ListItemType.Separator; case ListItemType.EditItem: Style edStyle = new TableItemStyle (); if ((item.ItemIndex % 2) == 0) { edStyle.CopyFrom (itemStyle); } else { edStyle.CopyFrom (deployStyle); } edStyle.CopyFrom (editItemStyle); item.MergeStyle (edStyle); goto case ListItemType.Separator; case ListItemType.Pager: if (pagerStyle == null) break; if (!pagerStyle.Visible) item.Visible = false; if (index == 0) { if (!pagerStyle.IsPagerOnTop) { item.Visible = false; break; } } else if (!pagerStyle.IsPagerOnBottom) { item.Visible = false; break; } item.MergeStyle (pagerStyle); goto case ListItemType.Separator; case ListItemType.Separator: TableCellCollection cells = item.Cells; int cellCount = cells.Count; if (cellCount > cols.Length) cellCount = cols.Length; if (cellCount > 0 && item.ItemType != ListItemType.Pager) { for (int i = 0; i < cellCount; i++) { Style colStyle = null; if (cols [i].Visible) { switch (item.ItemType) { case ListItemType.Header: colStyle = cols [i].HeaderStyleInternal; break; case ListItemType.Footer: colStyle = cols [i].FooterStyleInternal; break; default: colStyle = cols [i].ItemStyleInternal; break; } cells[i].MergeStyle (colStyle); } else { cells [i].Visible = false; } } } break; default: goto case ListItemType.Separator; } }
private void ApplyDefaultCreateUserValues() { _createUserStepContainer.UserNameLabel.Text = UserNameLabelText; WebControl userTextBox = (WebControl)_createUserStepContainer.UserNameTextBox; userTextBox.TabIndex = TabIndex; userTextBox.AccessKey = AccessKey; _createUserStepContainer.PasswordLabel.Text = PasswordLabelText; WebControl passwordTextBox = (WebControl)_createUserStepContainer.PasswordTextBox; passwordTextBox.TabIndex = TabIndex; _createUserStepContainer.ConfirmPasswordLabel.Text = ConfirmPasswordLabelText; WebControl confirmTextBox = (WebControl)_createUserStepContainer.ConfirmPasswordTextBox; confirmTextBox.TabIndex = TabIndex; if (_textBoxStyle != null) { userTextBox.ApplyStyle(_textBoxStyle); passwordTextBox.ApplyStyle(_textBoxStyle); confirmTextBox.ApplyStyle(_textBoxStyle); } LoginUtil.ApplyStyleToLiteral(_createUserStepContainer.Title, CreateUserStep.Title, TitleTextStyle, true); LoginUtil.ApplyStyleToLiteral(_createUserStepContainer.InstructionLabel, InstructionText, InstructionTextStyle, true); LoginUtil.ApplyStyleToLiteral(_createUserStepContainer.UserNameLabel, UserNameLabelText, LabelStyle, false); LoginUtil.ApplyStyleToLiteral(_createUserStepContainer.PasswordLabel, PasswordLabelText, LabelStyle, false); LoginUtil.ApplyStyleToLiteral(_createUserStepContainer.ConfirmPasswordLabel, ConfirmPasswordLabelText, LabelStyle, false); // VSWhidbey 447805 Do not render PasswordHintText if AutoGeneratePassword is false. if (!String.IsNullOrEmpty(PasswordHintText) && !AutoGeneratePassword) { LoginUtil.ApplyStyleToLiteral(_createUserStepContainer.PasswordHintLabel, PasswordHintText, PasswordHintStyle, false); } else { _passwordHintTableRow.Visible = false; } bool enableValidation = true; WebControl emailTextBox = null; if (RequireEmail) { LoginUtil.ApplyStyleToLiteral(_createUserStepContainer.EmailLabel, EmailLabelText, LabelStyle, false); emailTextBox = (WebControl)_createUserStepContainer.EmailTextBox; ((ITextControl)emailTextBox).Text = Email; RequiredFieldValidator emailRequired = _createUserStepContainer.EmailRequired; emailRequired.ToolTip = EmailRequiredErrorMessage; emailRequired.ErrorMessage = EmailRequiredErrorMessage; emailRequired.Enabled = enableValidation; emailRequired.Visible = enableValidation; if (_validatorTextStyle != null) { emailRequired.ApplyStyle(_validatorTextStyle); } emailTextBox.TabIndex = TabIndex; if (_textBoxStyle != null) { emailTextBox.ApplyStyle(_textBoxStyle); } } else { _emailRow.Visible = false; } WebControl questionTextBox = null; WebControl answerTextBox = null; RequiredFieldValidator questionRequired = _createUserStepContainer.QuestionRequired; RequiredFieldValidator answerRequired = _createUserStepContainer.AnswerRequired; bool qaValidatorsEnabled = enableValidation && QuestionAndAnswerRequired; questionRequired.Enabled = qaValidatorsEnabled; questionRequired.Visible = qaValidatorsEnabled; answerRequired.Enabled = qaValidatorsEnabled; answerRequired.Visible = qaValidatorsEnabled; if (QuestionAndAnswerRequired) { LoginUtil.ApplyStyleToLiteral(_createUserStepContainer.QuestionLabel, QuestionLabelText, LabelStyle, false); questionTextBox = (WebControl)_createUserStepContainer.QuestionTextBox; ((ITextControl)questionTextBox).Text = Question; questionTextBox.TabIndex = TabIndex; LoginUtil.ApplyStyleToLiteral(_createUserStepContainer.AnswerLabel, AnswerLabelText, LabelStyle, false); answerTextBox = (WebControl)_createUserStepContainer.AnswerTextBox; ((ITextControl)answerTextBox).Text = Answer; answerTextBox.TabIndex = TabIndex; if (_textBoxStyle != null) { questionTextBox.ApplyStyle(_textBoxStyle); answerTextBox.ApplyStyle(_textBoxStyle); } questionRequired.ToolTip = QuestionRequiredErrorMessage; questionRequired.ErrorMessage = QuestionRequiredErrorMessage; answerRequired.ToolTip = AnswerRequiredErrorMessage; answerRequired.ErrorMessage = AnswerRequiredErrorMessage; if (_validatorTextStyle != null) { questionRequired.ApplyStyle(_validatorTextStyle); answerRequired.ApplyStyle(_validatorTextStyle); } } else { _questionRow.Visible = false; _answerRow.Visible = false; } if (_defaultCreateUserNavigationTemplate != null) { ((BaseNavigationTemplateContainer)(CreateUserStep.CustomNavigationTemplateContainer)).NextButton = _defaultCreateUserNavigationTemplate.CreateUserButton; ((BaseNavigationTemplateContainer)(CreateUserStep.CustomNavigationTemplateContainer)).CancelButton = _defaultCreateUserNavigationTemplate.CancelButton; } RequiredFieldValidator passwordRequired = _createUserStepContainer.PasswordRequired; RequiredFieldValidator confirmPasswordRequired = _createUserStepContainer.ConfirmPasswordRequired; CompareValidator passwordCompareValidator = _createUserStepContainer.PasswordCompareValidator; RegularExpressionValidator regExpValidator = _createUserStepContainer.PasswordRegExpValidator; bool passwordValidatorsEnabled = enableValidation && !AutoGeneratePassword; passwordRequired.Enabled = passwordValidatorsEnabled; passwordRequired.Visible = passwordValidatorsEnabled; confirmPasswordRequired.Enabled = passwordValidatorsEnabled; confirmPasswordRequired.Visible = passwordValidatorsEnabled; passwordCompareValidator.Enabled = passwordValidatorsEnabled; passwordCompareValidator.Visible = passwordValidatorsEnabled; bool passRegExpEnabled = passwordValidatorsEnabled && PasswordRegularExpression.Length > 0; regExpValidator.Enabled = passRegExpEnabled; regExpValidator.Visible = passRegExpEnabled; if (!enableValidation) { _passwordRegExpRow.Visible = false; _passwordCompareRow.Visible = false; _emailRegExpRow.Visible = false; } if (AutoGeneratePassword) { _passwordTableRow.Visible = false; _confirmPasswordTableRow.Visible = false; _passwordRegExpRow.Visible = false; _passwordCompareRow.Visible = false; } else { passwordRequired.ErrorMessage = PasswordRequiredErrorMessage; passwordRequired.ToolTip = PasswordRequiredErrorMessage; confirmPasswordRequired.ErrorMessage = ConfirmPasswordRequiredErrorMessage; confirmPasswordRequired.ToolTip = ConfirmPasswordRequiredErrorMessage; passwordCompareValidator.ErrorMessage = ConfirmPasswordCompareErrorMessage; if (_validatorTextStyle != null) { passwordRequired.ApplyStyle(_validatorTextStyle); confirmPasswordRequired.ApplyStyle(_validatorTextStyle); passwordCompareValidator.ApplyStyle(_validatorTextStyle); } if (passRegExpEnabled) { regExpValidator.ValidationExpression = PasswordRegularExpression; regExpValidator.ErrorMessage = PasswordRegularExpressionErrorMessage; if (_validatorTextStyle != null) { regExpValidator.ApplyStyle(_validatorTextStyle); } } else { _passwordRegExpRow.Visible = false; } } RequiredFieldValidator userNameRequired = _createUserStepContainer.UserNameRequired; userNameRequired.ErrorMessage = UserNameRequiredErrorMessage; userNameRequired.ToolTip = UserNameRequiredErrorMessage; userNameRequired.Enabled = enableValidation; userNameRequired.Visible = enableValidation; if (_validatorTextStyle != null) { userNameRequired.ApplyStyle(_validatorTextStyle); } bool emailRegExpEnabled = enableValidation && EmailRegularExpression.Length > 0 && RequireEmail; RegularExpressionValidator emailRegExpValidator = _createUserStepContainer.EmailRegExpValidator; emailRegExpValidator.Enabled = emailRegExpEnabled; emailRegExpValidator.Visible = emailRegExpEnabled; if (EmailRegularExpression.Length > 0 && RequireEmail) { emailRegExpValidator.ValidationExpression = EmailRegularExpression; emailRegExpValidator.ErrorMessage = EmailRegularExpressionErrorMessage; if (_validatorTextStyle != null) { emailRegExpValidator.ApplyStyle(_validatorTextStyle); } } else { _emailRegExpRow.Visible = false; } // Link Setup string helpPageText = HelpPageText; bool helpPageTextVisible = (helpPageText.Length > 0); HyperLink helpPageLink = _createUserStepContainer.HelpPageLink; Image helpPageIcon = _createUserStepContainer.HelpPageIcon; helpPageLink.Visible = helpPageTextVisible; if (helpPageTextVisible) { helpPageLink.Text = helpPageText; helpPageLink.NavigateUrl = HelpPageUrl; helpPageLink.TabIndex = TabIndex; } string helpPageIconUrl = HelpPageIconUrl; bool helpPageIconVisible = (helpPageIconUrl.Length > 0); helpPageIcon.Visible = helpPageIconVisible; if (helpPageIconVisible) { helpPageIcon.ImageUrl = helpPageIconUrl; helpPageIcon.AlternateText = helpPageText; } LoginUtil.SetTableCellVisible(helpPageLink, helpPageTextVisible || helpPageIconVisible); if (_hyperLinkStyle != null && (helpPageTextVisible || helpPageIconVisible)) { // Apply style except font to table cell, then apply font and forecolor to HyperLinks // VSWhidbey 81289 TableItemStyle hyperLinkStyleExceptFont = new TableItemStyle(); hyperLinkStyleExceptFont.CopyFrom(_hyperLinkStyle); hyperLinkStyleExceptFont.Font.Reset(); LoginUtil.SetTableCellStyle(helpPageLink, hyperLinkStyleExceptFont); helpPageLink.Font.CopyFrom(_hyperLinkStyle.Font); helpPageLink.ForeColor = _hyperLinkStyle.ForeColor; } Control errorMessageLabel = _createUserStepContainer.ErrorMessageLabel; if (errorMessageLabel != null) { if (_failure && !String.IsNullOrEmpty(_unknownErrorMessage)) { ((ITextControl)errorMessageLabel).Text = _unknownErrorMessage; LoginUtil.SetTableCellStyle(errorMessageLabel, ErrorMessageStyle); LoginUtil.SetTableCellVisible(errorMessageLabel, true); } else { LoginUtil.SetTableCellVisible(errorMessageLabel, false); } } }
protected override void PrepareControlHierarchy() { if (ShowCheckAll) { if (this.Controls.Count != 0) { bool controlStyleCreated = base.ControlStyleCreated; Table table = (Table)this.Controls[0]; table.CopyBaseAttributes(this); if (controlStyleCreated && !base.ControlStyle.IsEmpty) { table.ApplyStyle(base.ControlStyle); } else { table.GridLines = GridLines.Both; table.CellSpacing = 0; } table.Caption = this.Caption; table.CaptionAlign = this.CaptionAlign; TableRowCollection rows = table.Rows; Style s = null; if (this.AlternatingRowStyle != null) { s = new TableItemStyle(); s.CopyFrom(this.RowStyle); s.CopyFrom(this.AlternatingRowStyle); } else { s = this.RowStyle; } int num = 0; bool flag2 = true; foreach (GridViewRow row in rows) { Style style2; switch (row.RowType) { case DataControlRowType.Header: if (this.ShowHeader && (this.HeaderStyle != null)) { row.MergeStyle(this.HeaderStyle); } goto Label_0256; case DataControlRowType.Footer: if (this.ShowFooter && (this.FooterStyle != null)) { row.MergeStyle(this.FooterStyle); } goto Label_0256; case DataControlRowType.DataRow: if ((row.RowState & DataControlRowState.Edit) == DataControlRowState.Normal) { goto Label_01D9; } style2 = new TableItemStyle(); if ((row.RowIndex % 2) == 0) { break; } style2.CopyFrom(s); goto Label_01A5; case DataControlRowType.Pager: if (row.Visible && (this.PagerStyle != null)) { row.MergeStyle(this.PagerStyle); } goto Label_0256; case DataControlRowType.EmptyDataRow: row.MergeStyle(this.EmptyDataRowStyle); goto Label_0256; default: goto Label_0256; } style2.CopyFrom(this.RowStyle); Label_01A5: if (row.RowIndex == this.SelectedIndex) { style2.CopyFrom(this.SelectedRowStyle); } style2.CopyFrom(this.EditRowStyle); row.MergeStyle(style2); goto Label_0256; Label_01D9: if ((row.RowState & DataControlRowState.Selected) != DataControlRowState.Normal) { Style style3 = new TableItemStyle(); if ((row.RowIndex % 2) != 0) { style3.CopyFrom(s); } else { style3.CopyFrom(this.RowStyle); } style3.CopyFrom(this.SelectedRowStyle); row.MergeStyle(style3); } else if ((row.RowState & DataControlRowState.Alternate) != DataControlRowState.Normal) { row.MergeStyle(s); } else { row.MergeStyle(this.RowStyle); } Label_0256: if ((row.RowType != DataControlRowType.Pager) && (row.RowType != DataControlRowType.EmptyDataRow)) { foreach (TableCell cell in row.Cells) { DataControlFieldCell cell2 = cell as DataControlFieldCell; if (cell2 != null) { DataControlField containingField = cell2.ContainingField; if (containingField != null) { if (!containingField.Visible) { cell.Visible = false; continue; } if ((row.RowType == DataControlRowType.DataRow) && flag2) { num++; } Style headerStyleInternal = null; switch (row.RowType) { case DataControlRowType.Header: headerStyleInternal = containingField.HeaderStyle; break; case DataControlRowType.Footer: headerStyleInternal = containingField.FooterStyle; break; default: headerStyleInternal = containingField.ItemStyle; break; } if (headerStyleInternal != null) { cell.MergeStyle(headerStyleInternal); } if (row.RowType == DataControlRowType.DataRow) { foreach (Control control in cell.Controls) { WebControl control2 = control as WebControl; Style controlStyleInternal = containingField.ControlStyle; if (((control2 != null) && (controlStyleInternal != null)) && !controlStyleInternal.IsEmpty) { control2.ControlStyle.CopyFrom(controlStyleInternal); } } } continue; } } } if (row.RowType == DataControlRowType.DataRow) { flag2 = false; } } } if ((this.Rows.Count > 0) && (num != this.Rows[0].Cells.Count)) { if (ShowCheckAll) { num++; } if ((this.TopPagerRow != null) && (this.TopPagerRow.Cells.Count > 0)) { this.TopPagerRow.Cells[0].ColumnSpan = num; } if ((this.BottomPagerRow != null) && (this.BottomPagerRow.Cells.Count > 0)) { this.BottomPagerRow.Cells[0].ColumnSpan = num; } } } } else { base.PrepareControlHierarchy(); } }
/// <devdoc> /// </devdoc> private void RenderTitle(HtmlTextWriter writer, DateTime visibleDate, CalendarSelectionMode selectionMode, bool buttonsActive, bool useAccessibleHeader) { writer.Write(ROWBEGINTAG); TableCell titleCell = new TableCell(); Table titleTable = new Table(); // default title table/cell styles titleCell.ColumnSpan = HasWeekSelectors(selectionMode) ? 8 : 7; titleCell.BackColor = Color.Silver; titleTable.GridLines = GridLines.None; titleTable.Width = Unit.Percentage(100); titleTable.CellSpacing = 0; TableItemStyle titleStyle = TitleStyle; ApplyTitleStyle(titleCell, titleTable, titleStyle); titleCell.RenderBeginTag(writer); titleTable.RenderBeginTag(writer); writer.Write(ROWBEGINTAG); NextPrevFormat nextPrevFormat = NextPrevFormat; TableItemStyle nextPrevStyle = new TableItemStyle(); nextPrevStyle.Width = Unit.Percentage(15); nextPrevStyle.CopyFrom(NextPrevStyle); if (ShowNextPrevMonth) { if (IsMinSupportedYearMonth(visibleDate)) { writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.RenderEndTag(); } else { string prevMonthText; if (nextPrevFormat == NextPrevFormat.ShortMonth || nextPrevFormat == NextPrevFormat.FullMonth) { int monthNo = threadCalendar.GetMonth(threadCalendar.AddMonths(visibleDate, - 1)); prevMonthText = GetMonthName(monthNo, (nextPrevFormat == NextPrevFormat.FullMonth)); } else { prevMonthText = PrevMonthText; } // Month navigation. The command starts with a "V" and the remainder is day difference from the // base date. DateTime prevMonthDate; // VSWhidbey 366243: Some calendar's min supported date is // not the first day of the month (e.g. JapaneseCalendar. // So if we are setting the second supported month, the prev // month link should always point to the first supported // date instead of the first day of the previous month. DateTime secondSupportedMonth = threadCalendar.AddMonths(minSupportedDate, 1); if (IsTheSameYearMonth(secondSupportedMonth, visibleDate)) { prevMonthDate = minSupportedDate; } else { prevMonthDate = threadCalendar.AddMonths(visibleDate, -1); } string prevMonthKey = NAVIGATE_MONTH_COMMAND + (prevMonthDate.Subtract(baseDate)).Days.ToString(CultureInfo.InvariantCulture); string previousMonthTitle = null; if (useAccessibleHeader) { previousMonthTitle = SR.GetString(SR.Calendar_PreviousMonthTitle); } RenderCalendarCell(writer, nextPrevStyle, prevMonthText, previousMonthTitle, buttonsActive, prevMonthKey); } } TableItemStyle cellMainStyle = new TableItemStyle(); if (titleStyle.HorizontalAlign != HorizontalAlign.NotSet) { cellMainStyle.HorizontalAlign = titleStyle.HorizontalAlign; } else { cellMainStyle.HorizontalAlign = HorizontalAlign.Center; } cellMainStyle.Wrap = titleStyle.Wrap; cellMainStyle.Width = Unit.Percentage(70); string titleText; switch (TitleFormat) { case TitleFormat.Month: titleText = visibleDate.ToString("MMMM", CultureInfo.CurrentCulture); break; case TitleFormat.MonthYear: string titlePattern = DateTimeFormatInfo.CurrentInfo.YearMonthPattern; // Some cultures have a comma in their YearMonthPattern, which does not look // right in a calendar. Use a fixed pattern for those. if (titlePattern.IndexOf(',') >= 0) { titlePattern = "MMMM yyyy"; } titleText = visibleDate.ToString(titlePattern, CultureInfo.CurrentCulture); break; default: Debug.Assert(false, "Unknown TitleFormat value!"); goto case TitleFormat.MonthYear; } RenderCalendarCell(writer, cellMainStyle, titleText, null, false, null); if (ShowNextPrevMonth) { if (IsMaxSupportedYearMonth(visibleDate)) { writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.RenderEndTag(); } else { // Style for this one is identical bar nextPrevStyle.HorizontalAlign = HorizontalAlign.Right; string nextMonthText; if (nextPrevFormat == NextPrevFormat.ShortMonth || nextPrevFormat == NextPrevFormat.FullMonth) { int monthNo = threadCalendar.GetMonth(threadCalendar.AddMonths(visibleDate, 1)); nextMonthText = GetMonthName(monthNo, (nextPrevFormat == NextPrevFormat.FullMonth)); } else { nextMonthText = NextMonthText; } // Month navigation. The command starts with a "V" and the remainder is day difference from the // base date. DateTime nextMonthDate = threadCalendar.AddMonths(visibleDate, 1); string nextMonthKey = NAVIGATE_MONTH_COMMAND + (nextMonthDate.Subtract(baseDate)).Days.ToString(CultureInfo.InvariantCulture); string nextMonthTitle = null; if (useAccessibleHeader) { nextMonthTitle = SR.GetString(SR.Calendar_NextMonthTitle); } RenderCalendarCell(writer, nextPrevStyle, nextMonthText, nextMonthTitle, buttonsActive, nextMonthKey); } } writer.Write(ROWENDTAG); titleTable.RenderEndTag(writer); titleCell.RenderEndTag(writer); writer.Write(ROWENDTAG); }
protected virtual void PrepareControlHierarchyForRendering() { ControlCollection controls = Controls; if (controls.Count != 1) { return; } Table outerTable = (Table)controls[0]; outerTable.CopyBaseAttributes(this); if (ControlStyleCreated) { outerTable.ApplyStyle(ControlStyle); } else { // Because we didn't create a ControlStyle yet, the settings // for the default style of the control need to be applied // to the child table control directly. outerTable.CellSpacing = 0; } TableRowCollection rows = outerTable.Rows; TableCell bodyCell = null; if (_headerTemplate != null) { TableRow headerRow = rows[0]; if (ShowHeader) { if (_headerStyle != null) { headerRow.Cells[0].MergeStyle(_headerStyle); } } else { headerRow.Visible = false; } bodyCell = rows[1].Cells[0]; } if (_footerTemplate != null) { TableRow footerRow = rows[rows.Count - 1]; if (ShowFooter) { if (_footerStyle != null) { footerRow.Cells[0].MergeStyle(_footerStyle); } } else { footerRow.Visible = false; } } if (bodyCell == null) { bodyCell = rows[0].Cells[0]; } ListViewPanel viewPanel = (ListViewPanel)bodyCell.Controls[0]; if (_viewStyle != null) { viewPanel.ApplyStyle(_viewStyle); if (ShowScrollBars) { viewPanel.Style["overflow"] = "scroll"; viewPanel.Style["overflow-x"] = "auto"; viewPanel.Style["overflow-y"] = "auto"; } } ListViewTable bodyTable = (ListViewTable)viewPanel.Controls[0]; bodyTable.Columns = Columns; foreach (ListViewItem item in _items) { TableItemStyle style = _itemStyle; TableItemStyle compositeStyle = null; ListViewItemType itemType = item.ItemType; if (((itemType & ListViewItemType.EditItem) != 0) && (_editItemStyle != null)) { if (style != null) { compositeStyle = new TableItemStyle(); compositeStyle.CopyFrom(style); compositeStyle.CopyFrom(_editItemStyle); } else { style = _editItemStyle; } } if (((itemType & ListViewItemType.SelectedItem) != 0) && (_selectedItemStyle != null)) { if (compositeStyle != null) { compositeStyle.CopyFrom(_selectedItemStyle); } else if (style != null) { compositeStyle = new TableItemStyle(); compositeStyle.CopyFrom(style); compositeStyle.CopyFrom(_selectedItemStyle); } else { style = _selectedItemStyle; } } if (compositeStyle != null) { item.MergeStyle(compositeStyle); } else if (style != null) { item.MergeStyle(style); } if (_renderClickSelectScript) { if ((itemType & ListViewItemType.SelectedItem) == 0) { item.Attributes["onclick"] = Page.GetPostBackEventReference(this, "S" + item.ItemIndex); item.Style["cursor"] = "hand"; } } } }
private void RenderDayHeader(HtmlTextWriter writer, DateTime visibleDate, CalendarSelectionMode selectionMode, bool buttonsActive, bool useAccessibleHeader) { writer.Write("<tr>"); DateTimeFormatInfo currentInfo = DateTimeFormatInfo.CurrentInfo; if (this.HasWeekSelectors(selectionMode)) { TableItemStyle style = new TableItemStyle { HorizontalAlign = HorizontalAlign.Center }; if (selectionMode == CalendarSelectionMode.DayWeekMonth) { int days = visibleDate.Subtract(baseDate).Days; int dayOfMonth = this.threadCalendar.GetDaysInMonth(this.threadCalendar.GetYear(visibleDate), this.threadCalendar.GetMonth(visibleDate), this.threadCalendar.GetEra(visibleDate)); if (this.IsMinSupportedYearMonth(visibleDate)) { dayOfMonth = (dayOfMonth - this.threadCalendar.GetDayOfMonth(visibleDate)) + 1; } else if (this.IsMaxSupportedYearMonth(visibleDate)) { dayOfMonth = this.threadCalendar.GetDayOfMonth(this.maxSupportedDate); } string eventArgument = "R" + (((days * 100) + dayOfMonth)).ToString(CultureInfo.InvariantCulture); style.CopyFrom(this.SelectorStyle); string title = null; if (useAccessibleHeader) { title = System.Web.SR.GetString("Calendar_SelectMonthTitle"); } this.RenderCalendarCell(writer, style, this.SelectMonthText, title, buttonsActive, eventArgument); } else { style.CopyFrom(this.DayHeaderStyle); this.RenderCalendarCell(writer, style, string.Empty, null, false, null); } } TableItemStyle style2 = new TableItemStyle { HorizontalAlign = HorizontalAlign.Center }; style2.CopyFrom(this.DayHeaderStyle); System.Web.UI.WebControls.DayNameFormat dayNameFormat = this.DayNameFormat; int num3 = this.NumericFirstDayOfWeek(); for (int i = num3; i < (num3 + 7); i++) { string dayName; int num5 = i % 7; switch (dayNameFormat) { case System.Web.UI.WebControls.DayNameFormat.Full: dayName = currentInfo.GetDayName((DayOfWeek) num5); break; case System.Web.UI.WebControls.DayNameFormat.FirstLetter: dayName = currentInfo.GetDayName((DayOfWeek) num5).Substring(0, 1); break; case System.Web.UI.WebControls.DayNameFormat.FirstTwoLetters: dayName = currentInfo.GetDayName((DayOfWeek) num5).Substring(0, 2); break; case System.Web.UI.WebControls.DayNameFormat.Shortest: dayName = currentInfo.GetShortestDayName((DayOfWeek) num5); break; default: dayName = currentInfo.GetAbbreviatedDayName((DayOfWeek) num5); break; } if (useAccessibleHeader) { string abbrText = currentInfo.GetDayName((DayOfWeek) num5); this.RenderCalendarHeaderCell(writer, style2, dayName, abbrText); } else { this.RenderCalendarCell(writer, style2, dayName, null, false, null); } } writer.Write("</tr>"); }
private void ApplyCompleteValues() { LoginUtil.ApplyStyleToLiteral(_completeStepContainer.SuccessTextLabel, CompleteSuccessText, _completeSuccessTextStyle, true); switch (ContinueButtonType) { case ButtonType.Link: _completeStepContainer.ContinuePushButton.Visible = false; _completeStepContainer.ContinueImageButton.Visible = false; _completeStepContainer.ContinueLinkButton.Text = ContinueButtonText; _completeStepContainer.ContinueLinkButton.ValidationGroup = ValidationGroup; _completeStepContainer.ContinueLinkButton.TabIndex = TabIndex; _completeStepContainer.ContinueLinkButton.AccessKey = AccessKey; break; case ButtonType.Button: _completeStepContainer.ContinueLinkButton.Visible = false; _completeStepContainer.ContinueImageButton.Visible = false; _completeStepContainer.ContinuePushButton.Text = ContinueButtonText; _completeStepContainer.ContinuePushButton.ValidationGroup = ValidationGroup; _completeStepContainer.ContinuePushButton.TabIndex = TabIndex; _completeStepContainer.ContinuePushButton.AccessKey = AccessKey; break; case ButtonType.Image: _completeStepContainer.ContinueLinkButton.Visible = false; _completeStepContainer.ContinuePushButton.Visible = false; _completeStepContainer.ContinueImageButton.ImageUrl = ContinueButtonImageUrl; _completeStepContainer.ContinueImageButton.AlternateText = ContinueButtonText; _completeStepContainer.ContinueImageButton.ValidationGroup = ValidationGroup; _completeStepContainer.ContinueImageButton.TabIndex = TabIndex; _completeStepContainer.ContinueImageButton.AccessKey = AccessKey; break; } if (!NavigationButtonStyle.IsEmpty) { _completeStepContainer.ContinuePushButton.ApplyStyle(NavigationButtonStyle); _completeStepContainer.ContinueImageButton.ApplyStyle(NavigationButtonStyle); _completeStepContainer.ContinueLinkButton.ApplyStyle(NavigationButtonStyle); } if (_continueButtonStyle != null) { _completeStepContainer.ContinuePushButton.ApplyStyle(_continueButtonStyle); _completeStepContainer.ContinueImageButton.ApplyStyle(_continueButtonStyle); _completeStepContainer.ContinueLinkButton.ApplyStyle(_continueButtonStyle); } LoginUtil.ApplyStyleToLiteral(_completeStepContainer.Title, CompleteStep.Title, _titleTextStyle, true); string editProfileText = EditProfileText; bool editProfileVisible = (editProfileText.Length > 0); HyperLink editProfileLink = _completeStepContainer.EditProfileLink; editProfileLink.Visible = editProfileVisible; if (editProfileVisible) { editProfileLink.Text = editProfileText; editProfileLink.NavigateUrl = EditProfileUrl; editProfileLink.TabIndex = TabIndex; if (_hyperLinkStyle != null) { // Apply style except font to table cell, then apply font and forecolor to HyperLinks // VSWhidbey 81289 Style hyperLinkStyleExceptFont = new TableItemStyle(); hyperLinkStyleExceptFont.CopyFrom(_hyperLinkStyle); hyperLinkStyleExceptFont.Font.Reset(); LoginUtil.SetTableCellStyle(editProfileLink, hyperLinkStyleExceptFont); editProfileLink.Font.CopyFrom(_hyperLinkStyle.Font); editProfileLink.ForeColor = _hyperLinkStyle.ForeColor; } } string editProfileIconUrl = EditProfileIconUrl; bool editProfileIconVisible = (editProfileIconUrl.Length > 0); Image editProfileIcon = _completeStepContainer.EditProfileIcon; editProfileIcon.Visible = editProfileIconVisible; if (editProfileIconVisible) { editProfileIcon.ImageUrl = editProfileIconUrl; editProfileIcon.AlternateText = EditProfileText; } LoginUtil.SetTableCellVisible(editProfileLink, editProfileVisible || editProfileIconVisible); // Copy the styles from the StepStyle property if defined. Table table = ((CompleteStepContainer)(CompleteStep.ContentTemplateContainer)).LayoutTable; table.Height = Height; table.Width = Width; }
private void RenderDays(HtmlTextWriter writer, DateTime firstDay, DateTime visibleDate, CalendarSelectionMode selectionMode, bool buttonsActive, bool useAccessibleHeader) { Unit unit; DateTime time = firstDay; TableItemStyle style = null; bool flag = this.HasWeekSelectors(selectionMode); if (flag) { style = new TableItemStyle { Width = Unit.Percentage(12.0), HorizontalAlign = HorizontalAlign.Center }; style.CopyFrom(this.SelectorStyle); unit = Unit.Percentage(12.0); } else { unit = Unit.Percentage(14.0); } bool flag2 = !(this.threadCalendar is HebrewCalendar); bool flag3 = (base.GetType() != typeof(System.Web.UI.WebControls.Calendar)) || (base.Events[EventDayRender] != null); TableItemStyle[] styleArray = new TableItemStyle[0x10]; int definedStyleMask = this.GetDefinedStyleMask(); DateTime todaysDate = this.TodaysDate; string selectWeekText = this.SelectWeekText; bool hasButton = buttonsActive && (selectionMode != CalendarSelectionMode.None); int month = this.threadCalendar.GetMonth(visibleDate); int days = firstDay.Subtract(baseDate).Days; bool flag5 = base.DesignMode && (this.SelectionMode != CalendarSelectionMode.None); int num4 = 0; if (this.IsMinSupportedYearMonth(visibleDate)) { num4 = ((int) this.threadCalendar.GetDayOfWeek(firstDay)) - this.NumericFirstDayOfWeek(); if (num4 < 0) { num4 += 7; } } bool flag6 = false; DateTime time3 = this.threadCalendar.AddMonths(this.maxSupportedDate, -1); bool flag7 = this.IsMaxSupportedYearMonth(visibleDate) || this.IsTheSameYearMonth(time3, visibleDate); for (int i = 0; i < 6; i++) { if (flag6) { return; } writer.Write("<tr>"); if (flag) { int num6 = (days * 100) + 7; if (num4 > 0) { num6 -= num4; } else if (flag7) { int num7 = this.maxSupportedDate.Subtract(time).Days; if (num7 < 6) { num6 -= 6 - num7; } } string eventArgument = "R" + num6.ToString(CultureInfo.InvariantCulture); string title = null; if (useAccessibleHeader) { int num8 = i + 1; title = System.Web.SR.GetString("Calendar_SelectWeekTitle", new object[] { num8.ToString(CultureInfo.InvariantCulture) }); } this.RenderCalendarCell(writer, style, selectWeekText, title, buttonsActive, eventArgument); } for (int j = 0; j < 7; j++) { string str4; if (num4 > 0) { j += num4; while (num4 > 0) { writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.RenderEndTag(); num4--; } } else if (flag6) { while (j < 7) { writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.RenderEndTag(); j++; } break; } int dayOfWeek = (int) this.threadCalendar.GetDayOfWeek(time); int dayOfMonth = this.threadCalendar.GetDayOfMonth(time); if ((dayOfMonth <= 0x1f) && flag2) { str4 = cachedNumbers[dayOfMonth]; } else { str4 = time.ToString("dd", CultureInfo.CurrentCulture); } CalendarDay day = new CalendarDay(time, (dayOfWeek == 0) || (dayOfWeek == 6), time.Equals(todaysDate), (this.selectedDates != null) && this.selectedDates.Contains(time), this.threadCalendar.GetMonth(time) != month, str4); int num12 = 0x10; if (day.IsSelected) { num12 |= 8; } if (day.IsOtherMonth) { num12 |= 2; } if (day.IsToday) { num12 |= 4; } if (day.IsWeekend) { num12 |= 1; } int styleMask = definedStyleMask & num12; int index = styleMask & 15; TableItemStyle style2 = styleArray[index]; if (style2 == null) { style2 = new TableItemStyle(); this.SetDayStyles(style2, styleMask, unit); styleArray[index] = style2; } string str5 = null; if (useAccessibleHeader) { str5 = time.ToString("m", CultureInfo.CurrentCulture); } if (flag3) { TableCell cell = new TableCell(); cell.ApplyStyle(style2); LiteralControl child = new LiteralControl(str4); cell.Controls.Add(child); day.IsSelectable = hasButton; this.OnDayRender(cell, day); child.Text = this.GetCalendarButtonText(days.ToString(CultureInfo.InvariantCulture), str4, str5, buttonsActive && day.IsSelectable, cell.ForeColor); cell.RenderControl(writer); } else { if (flag5 && style2.ForeColor.IsEmpty) { style2.ForeColor = this.defaultForeColor; } this.RenderCalendarCell(writer, style2, str4, str5, hasButton, days.ToString(CultureInfo.InvariantCulture)); } if ((flag7 && (time.Month == this.maxSupportedDate.Month)) && (time.Day == this.maxSupportedDate.Day)) { flag6 = true; } else { time = this.threadCalendar.AddDays(time, 1); days++; } } writer.Write("</tr>"); } }
/// <devdoc> /// </devdoc> protected internal virtual void PrepareControlHierarchy() { // The order of rows is autogenerated data rows, declared rows, then autogenerated command rows if (Controls.Count < 1) { return; } Debug.Assert(Controls[0] is Table); Table childTable = (Table)Controls[0]; childTable.CopyBaseAttributes(this); if (ControlStyleCreated && !ControlStyle.IsEmpty) { childTable.ApplyStyle(ControlStyle); } else { // Since we didn't create a ControlStyle yet, the default // settings for the default style of the control need to be applied // to the child table control directly // childTable.GridLines = GridLines.Both; childTable.CellSpacing = 0; } childTable.Caption = Caption; childTable.CaptionAlign = CaptionAlign; // the composite alternating item style, so we need to do just one // merge style on the actual item Style altRowStyle = new TableItemStyle(); altRowStyle.CopyFrom(_rowStyle); if (_alternatingRowStyle != null) { altRowStyle = new TableItemStyle(); altRowStyle.CopyFrom(_alternatingRowStyle); } Style compositeStyle; TableRowCollection rows = childTable.Rows; foreach (DetailsViewRow row in rows) { compositeStyle = new TableItemStyle(); DataControlRowState rowState = row.RowState; DataControlRowType rowType = row.RowType; DataControlFieldCell headerFieldCell = row.Cells[0] as DataControlFieldCell; DataControlField field = null; if (headerFieldCell != null) { field = headerFieldCell.ContainingField; } switch (rowType) { case DataControlRowType.Header: compositeStyle = _headerStyle; break; case DataControlRowType.Footer: compositeStyle = _footerStyle; break; case DataControlRowType.DataRow: compositeStyle.CopyFrom(_rowStyle); if ((rowState & DataControlRowState.Alternate) != 0) { compositeStyle.CopyFrom(altRowStyle); } if (field is ButtonFieldBase) { compositeStyle.CopyFrom(_commandRowStyle); break; } if ((rowState & DataControlRowState.Edit) != 0) { compositeStyle.CopyFrom(_editRowStyle); } if ((rowState & DataControlRowState.Insert) != 0) { if (_insertRowStyle != null) { compositeStyle.CopyFrom(_insertRowStyle); } else { compositeStyle.CopyFrom(_editRowStyle); } } break; case DataControlRowType.Pager: compositeStyle = _pagerStyle; break; case DataControlRowType.EmptyDataRow: compositeStyle = _emptyDataRowStyle; break; } if (compositeStyle != null && row.Visible) { row.MergeStyle(compositeStyle); } if (rowType == DataControlRowType.DataRow && field != null) { if (!field.Visible || (Mode == DetailsViewMode.Insert && !field.InsertVisible)) { row.Visible = false; } else { int contentCellIndex = 0; DataControlFieldCell contentFieldCell = null; if (headerFieldCell != null && headerFieldCell.ContainingField.ShowHeader) { headerFieldCell.MergeStyle(field.HeaderStyleInternal); headerFieldCell.MergeStyle(_fieldHeaderStyle); contentCellIndex = 1; } contentFieldCell = row.Cells[contentCellIndex] as DataControlFieldCell; if (contentFieldCell != null) { contentFieldCell.MergeStyle(field.ItemStyleInternal); } foreach (Control control in contentFieldCell.Controls) { WebControl webControl = control as WebControl; Style fieldControlStyle = field.ControlStyleInternal; if (webControl != null && fieldControlStyle != null && !fieldControlStyle.IsEmpty) { webControl.ControlStyle.CopyFrom(fieldControlStyle); } } } } } }
private void RenderTitle(HtmlTextWriter writer, DateTime visibleDate, CalendarSelectionMode selectionMode, bool buttonsActive, bool useAccessibleHeader) { string str4; writer.Write("<tr>"); TableCell titleCell = new TableCell(); Table titleTable = new Table(); titleCell.ColumnSpan = this.HasWeekSelectors(selectionMode) ? 8 : 7; titleCell.BackColor = Color.Silver; titleTable.GridLines = GridLines.None; titleTable.Width = Unit.Percentage(100.0); titleTable.CellSpacing = 0; TableItemStyle titleStyle = this.TitleStyle; this.ApplyTitleStyle(titleCell, titleTable, titleStyle); titleCell.RenderBeginTag(writer); titleTable.RenderBeginTag(writer); writer.Write("<tr>"); System.Web.UI.WebControls.NextPrevFormat nextPrevFormat = this.NextPrevFormat; TableItemStyle style = new TableItemStyle { Width = Unit.Percentage(15.0) }; style.CopyFrom(this.NextPrevStyle); if (this.ShowNextPrevMonth) { if (this.IsMinSupportedYearMonth(visibleDate)) { writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.RenderEndTag(); } else { string monthName; DateTime minSupportedDate; switch (nextPrevFormat) { case System.Web.UI.WebControls.NextPrevFormat.ShortMonth: case System.Web.UI.WebControls.NextPrevFormat.FullMonth: { int month = this.threadCalendar.GetMonth(this.threadCalendar.AddMonths(visibleDate, -1)); monthName = this.GetMonthName(month, nextPrevFormat == System.Web.UI.WebControls.NextPrevFormat.FullMonth); break; } default: monthName = this.PrevMonthText; break; } DateTime time2 = this.threadCalendar.AddMonths(this.minSupportedDate, 1); if (this.IsTheSameYearMonth(time2, visibleDate)) { minSupportedDate = this.minSupportedDate; } else { minSupportedDate = this.threadCalendar.AddMonths(visibleDate, -1); } string eventArgument = "V" + minSupportedDate.Subtract(baseDate).Days.ToString(CultureInfo.InvariantCulture); string title = null; if (useAccessibleHeader) { title = System.Web.SR.GetString("Calendar_PreviousMonthTitle"); } this.RenderCalendarCell(writer, style, monthName, title, buttonsActive, eventArgument); } } TableItemStyle style3 = new TableItemStyle(); if (titleStyle.HorizontalAlign != HorizontalAlign.NotSet) { style3.HorizontalAlign = titleStyle.HorizontalAlign; } else { style3.HorizontalAlign = HorizontalAlign.Center; } style3.Wrap = titleStyle.Wrap; style3.Width = Unit.Percentage(70.0); switch (this.TitleFormat) { case System.Web.UI.WebControls.TitleFormat.Month: str4 = visibleDate.ToString("MMMM", CultureInfo.CurrentCulture); break; default: { string yearMonthPattern = DateTimeFormatInfo.CurrentInfo.YearMonthPattern; if (yearMonthPattern.IndexOf(',') >= 0) { yearMonthPattern = "MMMM yyyy"; } str4 = visibleDate.ToString(yearMonthPattern, CultureInfo.CurrentCulture); break; } } this.RenderCalendarCell(writer, style3, str4, null, false, null); if (this.ShowNextPrevMonth) { if (this.IsMaxSupportedYearMonth(visibleDate)) { writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.RenderEndTag(); } else { string nextMonthText; style.HorizontalAlign = HorizontalAlign.Right; switch (nextPrevFormat) { case System.Web.UI.WebControls.NextPrevFormat.ShortMonth: case System.Web.UI.WebControls.NextPrevFormat.FullMonth: { int m = this.threadCalendar.GetMonth(this.threadCalendar.AddMonths(visibleDate, 1)); nextMonthText = this.GetMonthName(m, nextPrevFormat == System.Web.UI.WebControls.NextPrevFormat.FullMonth); break; } default: nextMonthText = this.NextMonthText; break; } DateTime time3 = this.threadCalendar.AddMonths(visibleDate, 1); string str7 = "V" + time3.Subtract(baseDate).Days.ToString(CultureInfo.InvariantCulture); string str8 = null; if (useAccessibleHeader) { str8 = System.Web.SR.GetString("Calendar_NextMonthTitle"); } this.RenderCalendarCell(writer, style, nextMonthText, str8, buttonsActive, str7); } } writer.Write("</tr>"); titleTable.RenderEndTag(writer); titleCell.RenderEndTag(writer); writer.Write("</tr>"); }
private void ApplyDefaultCreateUserValues() { this._createUserStepContainer.UserNameLabel.Text = this.UserNameLabelText; WebControl userNameTextBox = (WebControl) this._createUserStepContainer.UserNameTextBox; userNameTextBox.TabIndex = this.TabIndex; userNameTextBox.AccessKey = this.AccessKey; this._createUserStepContainer.PasswordLabel.Text = this.PasswordLabelText; WebControl passwordTextBox = (WebControl) this._createUserStepContainer.PasswordTextBox; passwordTextBox.TabIndex = this.TabIndex; this._createUserStepContainer.ConfirmPasswordLabel.Text = this.ConfirmPasswordLabelText; WebControl confirmPasswordTextBox = (WebControl) this._createUserStepContainer.ConfirmPasswordTextBox; confirmPasswordTextBox.TabIndex = this.TabIndex; if (this._textBoxStyle != null) { userNameTextBox.ApplyStyle(this._textBoxStyle); passwordTextBox.ApplyStyle(this._textBoxStyle); confirmPasswordTextBox.ApplyStyle(this._textBoxStyle); } LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.Title, this.CreateUserStep.Title, this.TitleTextStyle, true); LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.InstructionLabel, this.InstructionText, this.InstructionTextStyle, true); LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.UserNameLabel, this.UserNameLabelText, this.LabelStyle, false); LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.PasswordLabel, this.PasswordLabelText, this.LabelStyle, false); LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.ConfirmPasswordLabel, this.ConfirmPasswordLabelText, this.LabelStyle, false); if (!string.IsNullOrEmpty(this.PasswordHintText) && !this.AutoGeneratePassword) { LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.PasswordHintLabel, this.PasswordHintText, this.PasswordHintStyle, false); } else { this._passwordHintTableRow.Visible = false; } bool flag = true; WebControl emailTextBox = null; if (this.RequireEmail) { LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.EmailLabel, this.EmailLabelText, this.LabelStyle, false); emailTextBox = (WebControl) this._createUserStepContainer.EmailTextBox; ((ITextControl) emailTextBox).Text = this.Email; RequiredFieldValidator emailRequired = this._createUserStepContainer.EmailRequired; emailRequired.ToolTip = this.EmailRequiredErrorMessage; emailRequired.ErrorMessage = this.EmailRequiredErrorMessage; emailRequired.Enabled = flag; emailRequired.Visible = flag; if (this._validatorTextStyle != null) { emailRequired.ApplyStyle(this._validatorTextStyle); } emailTextBox.TabIndex = this.TabIndex; if (this._textBoxStyle != null) { emailTextBox.ApplyStyle(this._textBoxStyle); } } else { this._emailRow.Visible = false; } WebControl questionTextBox = null; WebControl answerTextBox = null; RequiredFieldValidator questionRequired = this._createUserStepContainer.QuestionRequired; RequiredFieldValidator answerRequired = this._createUserStepContainer.AnswerRequired; bool flag2 = flag && this.QuestionAndAnswerRequired; questionRequired.Enabled = flag2; questionRequired.Visible = flag2; answerRequired.Enabled = flag2; answerRequired.Visible = flag2; if (this.QuestionAndAnswerRequired) { LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.QuestionLabel, this.QuestionLabelText, this.LabelStyle, false); questionTextBox = (WebControl) this._createUserStepContainer.QuestionTextBox; ((ITextControl) questionTextBox).Text = this.Question; questionTextBox.TabIndex = this.TabIndex; LoginUtil.ApplyStyleToLiteral(this._createUserStepContainer.AnswerLabel, this.AnswerLabelText, this.LabelStyle, false); answerTextBox = (WebControl) this._createUserStepContainer.AnswerTextBox; ((ITextControl) answerTextBox).Text = this.Answer; answerTextBox.TabIndex = this.TabIndex; if (this._textBoxStyle != null) { questionTextBox.ApplyStyle(this._textBoxStyle); answerTextBox.ApplyStyle(this._textBoxStyle); } questionRequired.ToolTip = this.QuestionRequiredErrorMessage; questionRequired.ErrorMessage = this.QuestionRequiredErrorMessage; answerRequired.ToolTip = this.AnswerRequiredErrorMessage; answerRequired.ErrorMessage = this.AnswerRequiredErrorMessage; if (this._validatorTextStyle != null) { questionRequired.ApplyStyle(this._validatorTextStyle); answerRequired.ApplyStyle(this._validatorTextStyle); } } else { this._questionRow.Visible = false; this._answerRow.Visible = false; } if (this._defaultCreateUserNavigationTemplate != null) { ((Wizard.BaseNavigationTemplateContainer) this.CreateUserStep.CustomNavigationTemplateContainer).NextButton = this._defaultCreateUserNavigationTemplate.CreateUserButton; ((Wizard.BaseNavigationTemplateContainer) this.CreateUserStep.CustomNavigationTemplateContainer).CancelButton = this._defaultCreateUserNavigationTemplate.CancelButton; } RequiredFieldValidator passwordRequired = this._createUserStepContainer.PasswordRequired; RequiredFieldValidator confirmPasswordRequired = this._createUserStepContainer.ConfirmPasswordRequired; CompareValidator passwordCompareValidator = this._createUserStepContainer.PasswordCompareValidator; RegularExpressionValidator passwordRegExpValidator = this._createUserStepContainer.PasswordRegExpValidator; bool flag3 = flag && !this.AutoGeneratePassword; passwordRequired.Enabled = flag3; passwordRequired.Visible = flag3; confirmPasswordRequired.Enabled = flag3; confirmPasswordRequired.Visible = flag3; passwordCompareValidator.Enabled = flag3; passwordCompareValidator.Visible = flag3; bool flag4 = flag3 && (this.PasswordRegularExpression.Length > 0); passwordRegExpValidator.Enabled = flag4; passwordRegExpValidator.Visible = flag4; if (!flag) { this._passwordRegExpRow.Visible = false; this._passwordCompareRow.Visible = false; this._emailRegExpRow.Visible = false; } if (this.AutoGeneratePassword) { this._passwordTableRow.Visible = false; this._confirmPasswordTableRow.Visible = false; this._passwordRegExpRow.Visible = false; this._passwordCompareRow.Visible = false; } else { passwordRequired.ErrorMessage = this.PasswordRequiredErrorMessage; passwordRequired.ToolTip = this.PasswordRequiredErrorMessage; confirmPasswordRequired.ErrorMessage = this.ConfirmPasswordRequiredErrorMessage; confirmPasswordRequired.ToolTip = this.ConfirmPasswordRequiredErrorMessage; passwordCompareValidator.ErrorMessage = this.ConfirmPasswordCompareErrorMessage; if (this._validatorTextStyle != null) { passwordRequired.ApplyStyle(this._validatorTextStyle); confirmPasswordRequired.ApplyStyle(this._validatorTextStyle); passwordCompareValidator.ApplyStyle(this._validatorTextStyle); } if (flag4) { passwordRegExpValidator.ValidationExpression = this.PasswordRegularExpression; passwordRegExpValidator.ErrorMessage = this.PasswordRegularExpressionErrorMessage; if (this._validatorTextStyle != null) { passwordRegExpValidator.ApplyStyle(this._validatorTextStyle); } } else { this._passwordRegExpRow.Visible = false; } } RequiredFieldValidator userNameRequired = this._createUserStepContainer.UserNameRequired; userNameRequired.ErrorMessage = this.UserNameRequiredErrorMessage; userNameRequired.ToolTip = this.UserNameRequiredErrorMessage; userNameRequired.Enabled = flag; userNameRequired.Visible = flag; if (this._validatorTextStyle != null) { userNameRequired.ApplyStyle(this._validatorTextStyle); } bool flag5 = (flag && (this.EmailRegularExpression.Length > 0)) && this.RequireEmail; RegularExpressionValidator emailRegExpValidator = this._createUserStepContainer.EmailRegExpValidator; emailRegExpValidator.Enabled = flag5; emailRegExpValidator.Visible = flag5; if ((this.EmailRegularExpression.Length > 0) && this.RequireEmail) { emailRegExpValidator.ValidationExpression = this.EmailRegularExpression; emailRegExpValidator.ErrorMessage = this.EmailRegularExpressionErrorMessage; if (this._validatorTextStyle != null) { emailRegExpValidator.ApplyStyle(this._validatorTextStyle); } } else { this._emailRegExpRow.Visible = false; } string helpPageText = this.HelpPageText; bool flag6 = helpPageText.Length > 0; HyperLink helpPageLink = this._createUserStepContainer.HelpPageLink; Image helpPageIcon = this._createUserStepContainer.HelpPageIcon; helpPageLink.Visible = flag6; if (flag6) { helpPageLink.Text = helpPageText; helpPageLink.NavigateUrl = this.HelpPageUrl; helpPageLink.TabIndex = this.TabIndex; } string helpPageIconUrl = this.HelpPageIconUrl; bool flag7 = helpPageIconUrl.Length > 0; helpPageIcon.Visible = flag7; if (flag7) { helpPageIcon.ImageUrl = helpPageIconUrl; helpPageIcon.AlternateText = helpPageText; } LoginUtil.SetTableCellVisible(helpPageLink, flag6 || flag7); if ((this._hyperLinkStyle != null) && (flag6 || flag7)) { TableItemStyle style = new TableItemStyle(); style.CopyFrom(this._hyperLinkStyle); style.Font.Reset(); LoginUtil.SetTableCellStyle(helpPageLink, style); helpPageLink.Font.CopyFrom(this._hyperLinkStyle.Font); helpPageLink.ForeColor = this._hyperLinkStyle.ForeColor; } Control errorMessageLabel = this._createUserStepContainer.ErrorMessageLabel; if (errorMessageLabel != null) { if (this._failure && !string.IsNullOrEmpty(this._unknownErrorMessage)) { ((ITextControl) errorMessageLabel).Text = this._unknownErrorMessage; LoginUtil.SetTableCellStyle(errorMessageLabel, this.ErrorMessageStyle); LoginUtil.SetTableCellVisible(errorMessageLabel, true); } else { LoginUtil.SetTableCellVisible(errorMessageLabel, false); } } }
private void SetDayStyles(TableItemStyle style, int styleMask, Unit defaultWidth) { style.Width = defaultWidth; style.HorizontalAlign = HorizontalAlign.Center; if ((styleMask & 0x10) != 0) { style.CopyFrom(this.DayStyle); } if ((styleMask & 1) != 0) { style.CopyFrom(this.WeekendDayStyle); } if ((styleMask & 2) != 0) { style.CopyFrom(this.OtherMonthDayStyle); } if ((styleMask & 4) != 0) { style.CopyFrom(this.TodayDayStyle); } if ((styleMask & 8) != 0) { style.ForeColor = Color.White; style.BackColor = Color.Silver; style.CopyFrom(this.SelectedDayStyle); } }
protected override void PrepareControlHierarchy () { if (!HasControls () || Controls.Count == 0) return; // No one called CreateControlHierarchy() with DataSource != null Style alt = null; foreach (DataListItem item in Controls) { switch (item.ItemType) { case ListItemType.Item: item.MergeStyle (itemStyle); break; case ListItemType.AlternatingItem: if (alt == null) { if (alternatingItemStyle != null) { alt = new TableItemStyle (); alt.CopyFrom (itemStyle); alt.CopyFrom (alternatingItemStyle); } else alt = itemStyle; } item.MergeStyle (alt); break; case ListItemType.EditItem: if (editItemStyle != null) item.MergeStyle (editItemStyle); else item.MergeStyle (itemStyle); break; case ListItemType.Footer: if (!ShowFooter) { item.Visible = false; break; } if (footerStyle != null) item.MergeStyle (footerStyle); break; case ListItemType.Header: if (!ShowHeader) { item.Visible = false; break; } if (headerStyle != null) item.MergeStyle (headerStyle); break; case ListItemType.SelectedItem: if (selectedItemStyle != null) item.MergeStyle (selectedItemStyle); else item.MergeStyle (itemStyle); break; case ListItemType.Separator: if (separatorStyle != null) item.MergeStyle(separatorStyle); else item.MergeStyle (itemStyle); break; } } }
protected internal override void PrepareControlHierarchy() { ControlCollection controls = this.Controls; int count = controls.Count; if (count != 0) { Style s = null; if (this.alternatingItemStyle != null) { s = new TableItemStyle(); s.CopyFrom(this.itemStyle); s.CopyFrom(this.alternatingItemStyle); } else { s = this.itemStyle; } for (int i = 0; i < count; i++) { DataListItem item = (DataListItem)controls[i]; Style headerStyle = null; switch (item.ItemType) { case ListItemType.Header: if (this.ShowHeader) { headerStyle = this.headerStyle; } goto Label_015B; case ListItemType.Footer: if (this.ShowFooter) { headerStyle = this.footerStyle; } goto Label_015B; case ListItemType.Item: headerStyle = this.itemStyle; goto Label_015B; case ListItemType.AlternatingItem: headerStyle = s; goto Label_015B; case ListItemType.SelectedItem: headerStyle = new TableItemStyle(); if ((item.ItemIndex % 2) == 0) { break; } headerStyle.CopyFrom(s); goto Label_0100; case ListItemType.EditItem: headerStyle = new TableItemStyle(); if ((item.ItemIndex % 2) == 0) { goto Label_0128; } headerStyle.CopyFrom(s); goto Label_0134; case ListItemType.Separator: headerStyle = this.separatorStyle; goto Label_015B; default: goto Label_015B; } headerStyle.CopyFrom(this.itemStyle); Label_0100: headerStyle.CopyFrom(this.selectedItemStyle); goto Label_015B; Label_0128: headerStyle.CopyFrom(this.itemStyle); Label_0134: if (item.ItemIndex == this.SelectedIndex) { headerStyle.CopyFrom(this.selectedItemStyle); } headerStyle.CopyFrom(this.editItemStyle); Label_015B: if (headerStyle != null) { if (!this.extractTemplateRows) { item.MergeStyle(headerStyle); } else { IEnumerator enumerator = item.Controls.GetEnumerator(); while (enumerator.MoveNext()) { Control current = (Control)enumerator.Current; if (current is Table) { IEnumerator enumerator2 = ((Table)current).Rows.GetEnumerator(); while (enumerator2.MoveNext()) { ((TableRow)enumerator2.Current).MergeStyle(headerStyle); } break; } } } } } } }
protected override void PrepareControlHierarchy() { if (!HasControls() || Controls.Count == 0) { return; // No one called CreateControlHierarchy() with DataSource != null } Style alt = null; foreach (DataListItem item in Controls) { switch (item.ItemType) { case ListItemType.Item: item.MergeStyle(itemStyle); break; case ListItemType.AlternatingItem: if (alt == null) { if (alternatingItemStyle != null) { alt = new TableItemStyle(); alt.CopyFrom(itemStyle); alt.CopyFrom(alternatingItemStyle); } else { alt = itemStyle; } } item.MergeStyle(alt); break; case ListItemType.EditItem: if (editItemStyle != null) { item.MergeStyle(editItemStyle); } else { item.MergeStyle(itemStyle); } break; case ListItemType.Footer: if (!ShowFooter) { item.Visible = false; break; } if (footerStyle != null) { item.MergeStyle(footerStyle); } break; case ListItemType.Header: if (!ShowHeader) { item.Visible = false; break; } if (headerStyle != null) { item.MergeStyle(headerStyle); } break; case ListItemType.SelectedItem: if (selectedItemStyle != null) { item.MergeStyle(selectedItemStyle); } else { item.MergeStyle(itemStyle); } break; case ListItemType.Separator: if (separatorStyle != null) { item.MergeStyle(separatorStyle); } else { item.MergeStyle(itemStyle); } break; } } }
/// <devdoc> /// </devdoc> private void RenderDayHeader(HtmlTextWriter writer, DateTime visibleDate, CalendarSelectionMode selectionMode, bool buttonsActive, bool useAccessibleHeader) { writer.Write(ROWBEGINTAG); DateTimeFormatInfo dtf = DateTimeFormatInfo.CurrentInfo; if (HasWeekSelectors(selectionMode)) { TableItemStyle monthSelectorStyle = new TableItemStyle(); monthSelectorStyle.HorizontalAlign = HorizontalAlign.Center; // add the month selector button if required; if (selectionMode == CalendarSelectionMode.DayWeekMonth) { // Range selection. The command starts with an "R". The remainder is an integer. When divided by 100 // the result is the day difference from the base date of the first day, and the remainder is the // number of days to select. int startOffset = visibleDate.Subtract(baseDate).Days; int monthLength = threadCalendar.GetDaysInMonth(threadCalendar.GetYear(visibleDate), threadCalendar.GetMonth(visibleDate), threadCalendar.GetEra(visibleDate)); if (IsMinSupportedYearMonth(visibleDate)) { // The first supported month might not start with day 1 // (e.g. Sept 8 is the first supported date of JapaneseCalendar) monthLength = monthLength - threadCalendar.GetDayOfMonth(visibleDate) + 1; } else if (IsMaxSupportedYearMonth(visibleDate)) { // The last supported month might not have all days supported in that calendar month // (e.g. April 3 is the last supported date of HijriCalendar) monthLength = threadCalendar.GetDayOfMonth(maxSupportedDate); } string monthSelectKey = SELECT_RANGE_COMMAND + ((startOffset * 100) + monthLength).ToString(CultureInfo.InvariantCulture); monthSelectorStyle.CopyFrom(SelectorStyle); string selectMonthTitle = null; if (useAccessibleHeader) { selectMonthTitle = SR.GetString(SR.Calendar_SelectMonthTitle); } RenderCalendarCell(writer, monthSelectorStyle, SelectMonthText, selectMonthTitle, buttonsActive, monthSelectKey); } else { // otherwise make it look like the header row monthSelectorStyle.CopyFrom(DayHeaderStyle); RenderCalendarCell(writer, monthSelectorStyle, string.Empty, null, false, null); } } TableItemStyle dayNameStyle = new TableItemStyle(); dayNameStyle.HorizontalAlign = HorizontalAlign.Center; dayNameStyle.CopyFrom(DayHeaderStyle); DayNameFormat dayNameFormat = DayNameFormat; int numericFirstDay = NumericFirstDayOfWeek(); for (int i = numericFirstDay; i < numericFirstDay + 7; i++) { string dayName; int dayOfWeek = i % 7; switch (dayNameFormat) { case DayNameFormat.FirstLetter: dayName = dtf.GetDayName((DayOfWeek)dayOfWeek).Substring(0, 1); break; case DayNameFormat.FirstTwoLetters: dayName = dtf.GetDayName((DayOfWeek)dayOfWeek).Substring(0, 2); break; case DayNameFormat.Full: dayName = dtf.GetDayName((DayOfWeek)dayOfWeek); break; case DayNameFormat.Short: dayName = dtf.GetAbbreviatedDayName((DayOfWeek)dayOfWeek); break; case DayNameFormat.Shortest: dayName = dtf.GetShortestDayName((DayOfWeek)dayOfWeek); break; default: Debug.Assert(false, "Unknown DayNameFormat value!"); goto case DayNameFormat.Short; } if (useAccessibleHeader) { string fullDayName = dtf.GetDayName((DayOfWeek)dayOfWeek); RenderCalendarHeaderCell(writer, dayNameStyle, dayName, fullDayName); } else { RenderCalendarCell(writer, dayNameStyle, dayName, null, false, null); } } writer.Write(ROWENDTAG); }