本文整理汇总了C#中System.Web.UI.WebControls.TableCell.RenderBeginTag方法的典型用法代码示例。如果您正苦于以下问题:C# TableCell.RenderBeginTag方法的具体用法?C# TableCell.RenderBeginTag怎么用?C# TableCell.RenderBeginTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.TableCell
的用法示例。
在下文中一共展示了TableCell.RenderBeginTag方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteTitle
void WriteTitle (HtmlTextWriter writer)
{
TableCell cellNextPrev = null;
TableCell titleCell = new TableCell ();
Table tableTitle = new Table ();
writer.RenderBeginTag (HtmlTextWriterTag.Tr);
titleCell.ColumnSpan = HasWeekSelectors (SelectionMode) ? 8 : 7;
if (titleStyle != null && !titleStyle.IsEmpty && !titleStyle.BackColor.IsEmpty) {
titleCell.BackColor = titleStyle.BackColor;
} else {
titleCell.BackColor = Color.Silver;
}
titleCell.RenderBeginTag (writer);
// Table
tableTitle.Width = Unit.Percentage (100);
if (titleStyle != null && !titleStyle.IsEmpty) {
tableTitle.ApplyStyle (titleStyle);
}
tableTitle.RenderBeginTag (writer);
writer.RenderBeginTag (HtmlTextWriterTag.Tr);
if (ShowNextPrevMonth) { // Previous Table Data
cellNextPrev = new TableCell ();
cellNextPrev.ApplyStyle (nextPrevStyle);
cellNextPrev.Width = Unit.Percentage (15);
DateTime date = GetGlobalCalendar().AddMonths (DisplayDate, - 1);
date = GetGlobalCalendar ().AddDays (date, -date.Day + 1);
cellNextPrev.RenderBeginTag (writer);
writer.Write (BuildLink ("V" + GetDaysFromZenith (date), GetNextPrevFormatText (date, false), cellNextPrev.ForeColor, Enabled));
cellNextPrev.RenderEndTag (writer);
}
// Current Month Table Data
{
DateTimeFormatInfo dti = DateInfo;
string str;
TableCell cellMonth = new TableCell ();
cellMonth.Width = Unit.Percentage (70);
cellMonth.HorizontalAlign = HorizontalAlign.Center;
cellMonth.RenderBeginTag (writer);
if (TitleFormat == TitleFormat.MonthYear)
str = DisplayDate.ToString (dti.YearMonthPattern, dti);
else
str = dti.GetMonthName (GetGlobalCalendar ().GetMonth (DisplayDate));
writer.Write (str);
cellMonth.RenderEndTag (writer);
}
if (ShowNextPrevMonth) { // Next Table Data
DateTime date = GetGlobalCalendar().AddMonths (DisplayDate, + 1);
date = GetGlobalCalendar ().AddDays (date, -date.Day + 1);
cellNextPrev.HorizontalAlign = HorizontalAlign.Right;
cellNextPrev.RenderBeginTag (writer);
writer.Write (BuildLink ("V" + GetDaysFromZenith (date), GetNextPrevFormatText (date, true), cellNextPrev.ForeColor, Enabled));
cellNextPrev.RenderEndTag (writer);
}
writer.RenderEndTag ();
tableTitle.RenderEndTag (writer);
titleCell.RenderEndTag (writer);
writer.RenderEndTag (); //tr
}
示例2: WriteDayHeader
//
// Private methods
//
void WriteDayHeader (HtmlTextWriter writer)
{
int i, first;
string dayName;
i = first = (int) (DisplayFirstDayOfWeek);
TableCell cell;
writer.RenderBeginTag (HtmlTextWriterTag.Tr);
if (SelectionMode == CalendarSelectionMode.DayWeek) {
cell = new TableCell();
cell.HorizontalAlign = HorizontalAlign.Center;
cell.ApplyStyle (DayHeaderStyle);
// Empty Cell
cell.RenderBeginTag (writer);
cell.RenderEndTag (writer);
} else {
if (SelectionMode == CalendarSelectionMode.DayWeekMonth) {
TableCell selector = new TableCell ();
selector.ApplyStyle (SelectorStyle);
selector.HorizontalAlign = HorizontalAlign.Center;
DateTime date = new DateTime (DisplayDate.Year, DisplayDate.Month, 1); // first date
int days = DateTime.DaysInMonth (DisplayDate.Year, DisplayDate.Month);
selector.RenderBeginTag (writer);
writer.Write (BuildLink ("R" + GetDaysFromZenith (date) + days, SelectMonthText, DayHeaderStyle.ForeColor, Enabled));
selector.RenderEndTag (writer);
}
}
DateTimeFormatInfo dti = DateInfo;
while (true) {
DayOfWeek dayOfWeek = (DayOfWeek) i;
dayName = dti.GetDayName (dayOfWeek);
#if NET_2_0
if (UseAccessibleHeader) {
writer.AddAttribute (HtmlTextWriterAttribute.Abbr, dayName);
writer.AddAttribute (HtmlTextWriterAttribute.Scope, "col", false);
cell = new TableHeaderCell();
}
else
#endif
cell = new TableCell();
cell.HorizontalAlign = HorizontalAlign.Center;
cell.ApplyStyle (DayHeaderStyle);
cell.RenderBeginTag (writer);
switch (DayNameFormat) {
case DayNameFormat.FirstLetter:
dayName = dayName.Substring (0, 1);
break;
case DayNameFormat.FirstTwoLetters:
dayName = dayName.Substring (0, 2);
break;
#if NET_2_0
case DayNameFormat.Shortest:
dayName = dti.GetShortestDayName (dayOfWeek);
break;
#endif
case DayNameFormat.Full:
break;
case DayNameFormat.Short:
default:
dayName = dti.GetAbbreviatedDayName (dayOfWeek);
break;
}
writer.Write (dayName);
cell.RenderEndTag (writer);
if (i >= daysInAWeek - 1) {
i = 0;
}
else {
i++;
}
if (i == first)
break;
}
writer.RenderEndTag ();
}
示例3: RenderTitle
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
//.........这里部分代码省略.........
示例4: GetCallbackResult
public string GetCallbackResult()
{
//return string.Empty;
ThemeHelper theme = new ThemeHelper(Theme);
if (!Enabled)
{
return string.Empty;
}
mv.Width = DateBoxWidth;
mv.BorderStyle = BorderStyle.None;
mv.ShowTitle = false;
mv.DayRender += MonthViewDayRender;
mv.Font.Name = "Tahoma";
mv.DayStyle.MergeWith(theme.DayStyle);
mv.DayHeaderStyle.MergeWith(theme.DayStyle);
mv.SelectedDayStyle.MergeWith(theme.SelectedDayStyle);
mv.TodayDayStyle.MergeWith(theme.TodayDayStyle);
//next & prev formats
DropDownList list = theme.CreateFooterDropDownList();
//list.MergeStyle(monthYearDropDownStyle);
StringBuilder sb = new StringBuilder();
StringWriter writer = new StringWriter(sb);
HtmlTextWriter tw = new HtmlTextWriter(writer);
if (this.EnableDropShadow)
{
tw.AddStyleAttribute(HtmlTextWriterStyle.Display, "#EFEFEF");
}
tw.AddAttribute(HtmlTextWriterAttribute.Id, "FADatePickerDropShadow_" + this.ClientID);
tw.AddStyleAttribute(HtmlTextWriterStyle.ZIndex, (this.ZIndex + 1).ToString());
tw.AddStyleAttribute(HtmlTextWriterStyle.Left, this.CalendarOffsetX.ToString());
tw.AddStyleAttribute(HtmlTextWriterStyle.Top, this.CalendarOffsetY.ToString());
tw.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
tw.AddStyleAttribute(HtmlTextWriterStyle.Display, "inline");
tw.AddStyleAttribute("min-width", this.mv.Width.ToString());
tw.AddAttribute("CellPadding", "0");
tw.AddAttribute("CellSpacing", "0");
tw.RenderBeginTag(HtmlTextWriterTag.Table);
tw.RenderBeginTag(HtmlTextWriterTag.Tr);
tw.RenderBeginTag(HtmlTextWriterTag.Td);
tw.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "white");
tw.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, "gray");
tw.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "solid");
tw.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "1px");
tw.AddStyleAttribute(HtmlTextWriterStyle.Left, "-4px");
tw.AddStyleAttribute(HtmlTextWriterStyle.Top, "-4px");
tw.AddStyleAttribute(HtmlTextWriterStyle.Width, this.mv.Width.ToString());
tw.AddAttribute(HtmlTextWriterAttribute.Id, "FADatePickerCalendarContainer_" + this.ClientID);
tw.AddAttribute("CellPadding", "0");
tw.AddAttribute("CellSpacing", "0");
tw.RenderBeginTag(HtmlTextWriterTag.Table);
tw.RenderBeginTag(HtmlTextWriterTag.Tr);
tw.RenderBeginTag(HtmlTextWriterTag.Td);
Table table = theme.CreateTitleTable(this.Page);
table.Width = Unit.Percentage(100.0);
table.MergeStyle(this.MonthViewTitleStyle);
table.ID = "FADatePickerCalendarTitle_" + this.ClientID;
table.RenderBeginTag(tw);
tw.RenderBeginTag(HtmlTextWriterTag.Tr);
TableCell cell = new TableCell();
cell.Style.Add(HtmlTextWriterStyle.TextAlign, "left");
cell.MergeStyle(this.MonthViewNextPrevStyle);
cell.RenderBeginTag(tw);
if ((this.mv.VisibleDate.Month > this.MinDate.Month) || (this.mv.VisibleDate.Year > this.MinDate.Year))
{
try
{
DateTime dt = this.mv.VisibleDate.AddMonths(-1);
dt = dt.AddDays((double)-(dt.Day - 1));
if (this.NextPrevFormat == NextPrevFormat.ShortMonth)
{
tw.WriteLine("<div style='cursor:pointer;' onclick=\"javascript:CallServer_" + this.ClientID + "('" + dt.ToShortDateString() + "')\">" + dt.ToString("MMM") + "</div>");
}
else if (this.NextPrevFormat == NextPrevFormat.FullMonth)
{
tw.WriteLine("<div style='cursor:pointer;' onclick=\"javascript:CallServer_" + this.ClientID + "('" + dt.ToShortDateString() + "')\">" + dt.ToString("MMMM") + "</div>");
}
else
{
tw.WriteLine("<div style='cursor:pointer;' onclick=\"javascript:CallServer_" + this.ClientID + "('" + dt.ToShortDateString() + "')\">" + this.PrevMonthText + "</div>");
}
}
catch
{
}
}
cell.RenderEndTag(tw);
tw.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
tw.RenderBeginTag(HtmlTextWriterTag.Td);
tw.WriteLine(this.mv.VisibleDate.ToString("MMMM yyyy"));
tw.RenderEndTag();
TableCell cell2 = new TableCell();
//.........这里部分代码省略.........
示例5: RenderContents
/// <summary>
///
/// </summary>
/// <param name="writer"></param>
/// <author>
/// Created by Iulian Iuga; 30 December, 2002
/// </author>
protected void RenderContents( HtmlTextWriter writer )
{
TableRow _tr = new TableRow();
TableCell _td = new TableCell();
_tr.RenderBeginTag( writer );
// apply CssClass for current element
if( _element.TreeWeb.DefaultElementCssClass.Length > 0 )
_td.CssClass = _element.TreeWeb.DefaultElementCssClass;
if( _element.CssClass.Length > 0 )
_td.CssClass = _element.CssClass;
//_td.Style.Add( "display", "none" );
_td.Attributes.Add( "nowrap", "yes" );
_td.RenderBeginTag( writer );
// render a at the begining of each element
writer.Write( " " );
// render element indentation based on element level
string _indentation = "";
int nIndentationPerStep = _element.TreeWeb.Indentation;
for( int index = 0; index < (_element.Level * nIndentationPerStep); index++ )
_indentation += _indentationStep;
writer.Write( _indentation );
// render the expand/collapse link if the element has child elements and is expandable.
if( _element.HasElements )
{
HyperLink _link = new HyperLink();
Image _image = new Image();
if( _element.TreeWeb.Expandable && _element.Expandable )
{
if( _element.IsExpanded )
{
_link.Text = _expcol[1];
if( _element.TreeWeb.ExpandedElementImage.Length > 0 )
_image.ImageUrl = _element.TreeWeb.ExpandedElementImage;
}
else
{
_link.Text = _expcol[0];
if( _element.TreeWeb.CollapsedElementImage.Length > 0 )
_image.ImageUrl = _element.TreeWeb.CollapsedElementImage;
}
}
string scriptCode = "javascript:";
scriptCode += _element.TreeWeb.Page.GetPostBackEventReference( _element.TreeWeb, _element.ID );
_link.NavigateUrl = scriptCode;
if( _image.ImageUrl.Length > 0 )
{
_link.RenderBeginTag( writer );
_image.RenderControl( writer );
_link.RenderEndTag( writer );
}
else
_link.RenderControl( writer );
_image = null;
_link = null;
writer.Write( " " );
}
// render checkbox
if( _element.TreeWeb.CheckBoxes || _element.CheckBox )
{
CheckBox _checkbox = new CheckBox();
_checkbox.ID = _element.ID + TreeElement._separator + TreeElement._checkboxIDSufix;
_checkbox.RenderControl( writer );
_checkbox = null;
// write a non-breaking space before the element text
writer.Write( " " );
}
// render element's image if it has one
if( _element.ImageIndex > -1 )
{
ElementImage _elementImage = _element.TreeWeb.ImageList[_element.ImageIndex];
if( _elementImage != null )
{
Image _image = new Image();
_image.ImageUrl = _elementImage.ImageUrl;
_image.RenderControl( writer );
_image = null;
//.........这里部分代码省略.........
示例6: RenderCalendarCell
private void RenderCalendarCell (HtmlTextWriter writer, TableCell cell, string text)
{
cell.RenderBeginTag(writer);
writer.Write(text);
cell.RenderEndTag(writer);
}
示例7: RenderTitle
private void RenderTitle (HtmlTextWriter writer,
DateTime visibleDate,
CalendarSelectionMode mode,
bool isActive)
{
writer.Write("<tr>");
Table innerTable = new Table ();
TableCell titleCell = new TableCell();
bool isWeekMode = (mode == CalendarSelectionMode.DayWeek ||
mode == CalendarSelectionMode.DayWeekMonth);
titleCell.ColumnSpan = (isWeekMode ? 8 : 7);
titleCell.BackColor = Color.Silver;
innerTable.GridLines = GridLines.None;
innerTable.Width = Unit.Percentage (100);
innerTable.CellSpacing = 0;
ApplyTitleStyle (innerTable, titleCell, TitleStyle);
titleCell.RenderBeginTag (writer);
innerTable.RenderBeginTag (writer);
writer.Write ("<tr>");
string prevContent = String.Empty;
if (ShowNextPrevMonth) {
TableCell prevCell = new TableCell ();
prevCell.Width = Unit.Percentage (15);
prevCell.HorizontalAlign = HorizontalAlign.Left;
if (NextPrevFormat == NextPrevFormat.CustomText) {
prevContent = PrevMonthText;
} else {
int pMthInt = globCal.GetMonth(globCal.AddMonths (visibleDate, -1));
if (NextPrevFormat == NextPrevFormat.FullMonth)
prevContent = infoCal.GetMonthName (pMthInt);
else
prevContent = infoCal.GetAbbreviatedMonthName (pMthInt);
}
DateTime prev_month = visibleDate.AddMonths (-1);
int prev_offset = (int) (new DateTime (prev_month.Year,
prev_month.Month, 1) - begin_date).TotalDays;
prevCell.ApplyStyle (NextPrevStyle);
RenderCalendarCell (writer,
prevCell,
GetCalendarLinkText ("V" + prev_offset,
prevContent,
"Go to previous month",
NextPrevStyle.ForeColor,
isActive)
);
}
TableCell currCell = new TableCell ();
currCell.Width = Unit.Percentage (70);
if (TitleStyle.HorizontalAlign == HorizontalAlign.NotSet)
currCell.HorizontalAlign = HorizontalAlign.Center;
else
currCell.HorizontalAlign = TitleStyle.HorizontalAlign;
currCell.Wrap = TitleStyle.Wrap;
string currMonthContent = String.Empty;
if (TitleFormat == TitleFormat.Month) {
currMonthContent = visibleDate.ToString ("MMMM");
} else {
string cmcFmt = infoCal.YearMonthPattern;
if (cmcFmt.IndexOf (',') >= 0)
cmcFmt = "MMMM yyyy";
currMonthContent = visibleDate.ToString (cmcFmt);
}
RenderCalendarCell (writer, currCell, currMonthContent);
string nextContent = String.Empty;
if (ShowNextPrevMonth) {
TableCell nextCell = new TableCell ();
nextCell.Width = Unit.Percentage(15);
nextCell.HorizontalAlign = HorizontalAlign.Right;
if (NextPrevFormat == NextPrevFormat.CustomText) {
nextContent = NextMonthText;
} else {
int nMthInt = globCal.GetMonth (globCal.AddMonths (visibleDate, 1));
if(NextPrevFormat == NextPrevFormat.FullMonth)
nextContent = infoCal.GetMonthName(nMthInt);
else
nextContent = infoCal.GetAbbreviatedMonthName(nMthInt);
}
DateTime next_month = visibleDate.AddMonths (1);
int next_offset = (int) (new DateTime (next_month.Year,
next_month.Month, 1) - begin_date).TotalDays;
nextCell.ApplyStyle(NextPrevStyle);
RenderCalendarCell (writer,
nextCell,
GetCalendarLinkText ("V" + next_offset,
nextContent,
"Go to next month",
NextPrevStyle.ForeColor,
isActive)
);
}
//.........这里部分代码省略.........
示例8: RenderItemCell
/// <summary>
/// Renders a table cell of a given toolbar item.
/// </summary>
/// <param name="item">Item to be rendered.</param>
/// <param name="writer">Writer that streams output to the client.</param>
protected void RenderItemCell(ToolbarItem item, HtmlTextWriter writer)
{
TableCell cell = new TableCell();
cell.HorizontalAlign = item.HorizontalAlign;
cell.VerticalAlign = item.VerticalAlign;
if (item is ToolbarSeparator)
{
//set separator height (custom if set or toolbar property)
if (this.Orientation == ToolbarOrientation.Horizontal)
//set the cell width on a horizontal toolbar
cell.Width = item.ItemCellDistance == Unit.Empty ? this.SeparatorCellDistance : item.ItemCellDistance;
else
//set the cell height on a vertical toolbar
cell.Height = item.ItemCellDistance == Unit.Empty ? this.SeparatorCellDistance : item.ItemCellDistance;
if (this.SeparatorImageUrl != String.Empty)
{
Image img = new Image();
img.ImageUrl = this.SeparatorImageUrl;
cell.Controls.Add(img);
}
else
{
cell.Text = " ";
}
cell.RenderControl(writer);
}
else
{
if (this.Orientation == ToolbarOrientation.Horizontal)
//set the cell width on a horizontal toolbar
cell.Width = item.ItemCellDistance == Unit.Empty ? this.ItemCellDistance : item.ItemCellDistance;
else
//set the cell height on a vertical toolbar
cell.Height = item.ItemCellDistance == Unit.Empty ? this.ItemCellDistance : item.ItemCellDistance;
//render the item
cell.RenderBeginTag(writer);
item.RenderControl(writer);
cell.RenderEndTag(writer);
}
}
示例9: RenderTitle
/// <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);
//.........这里部分代码省略.........