本文整理汇总了C#中System.Web.UI.WebControls.Table.RenderBeginTag方法的典型用法代码示例。如果您正苦于以下问题:C# Table.RenderBeginTag方法的具体用法?C# Table.RenderBeginTag怎么用?C# Table.RenderBeginTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.Table
的用法示例。
在下文中一共展示了Table.RenderBeginTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderBeginTag_Caption_Align
public void RenderBeginTag_Caption_Align ()
{
HtmlTextWriter writer = GetWriter ();
Table t = new Table ();
t.Caption = "caption";
t.CaptionAlign = TableCaptionAlign.Top;
t.RenderBeginTag (writer);
string s = writer.InnerWriter.ToString ();
Assert.AreEqual ("<table border=\"0\">\n\t<caption align=\"top\">\n\t\tcaption\n\t</caption>", s.ToLower (), "caption");
}
示例2: RenderBeginTag_Null
public void RenderBeginTag_Null ()
{
Table t = new Table ();
t.RenderBeginTag (null);
}
示例3: RenderBeginTag_Attributes
public void RenderBeginTag_Attributes ()
{
HtmlTextWriter writer = GetWriter ();
Table t = new Table ();
t.CellPadding = 1;
t.RenderBeginTag (writer);
string s = writer.InnerWriter.ToString ();
Assert.AreEqual ("<table cellpadding=\"1\" border=\"0\">\n", s, "CellPadding");
}
示例4: 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
//.........这里部分代码省略.........
示例5: RenderContents
protected override void RenderContents (HtmlTextWriter writer)
{
if (Controls.Count == 0)
return;
RepeatInfo repeater = new RepeatInfo ();
Table templateTable = null;
if (extractTemplateRows) {
repeater.RepeatDirection = RepeatDirection.Vertical;
repeater.RepeatLayout = RepeatLayout.Flow;
repeater.RepeatColumns = 1;
repeater.OuterTableImplied = true;
templateTable = new Table ();
templateTable.ID = ClientID;
templateTable.CopyBaseAttributes (this);
templateTable.ApplyStyle (ControlStyle);
templateTable.RenderBeginTag (writer);
} else {
repeater.RepeatDirection = RepeatDirection;
repeater.RepeatLayout = RepeatLayout;
repeater.RepeatColumns = RepeatColumns;
}
repeater.RenderRepeater (writer, this, ControlStyle, this);
if (templateTable != null) {
templateTable.RenderEndTag (writer);
}
}
示例6: RenderContents
protected internal override void RenderContents(HtmlTextWriter writer)
{
if (this.Controls.Count != 0)
{
RepeatInfo info = new RepeatInfo();
Table table = null;
Style controlStyle = base.ControlStyle;
if (this.extractTemplateRows)
{
info.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Vertical;
info.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Flow;
info.RepeatColumns = 1;
info.OuterTableImplied = true;
table = new Table {
ID = this.ClientID
};
table.CopyBaseAttributes(this);
table.Caption = this.Caption;
table.CaptionAlign = this.CaptionAlign;
table.ApplyStyle(controlStyle);
table.RenderBeginTag(writer);
}
else
{
info.RepeatDirection = this.RepeatDirection;
info.RepeatLayout = this.RepeatLayout;
info.RepeatColumns = this.RepeatColumns;
if (info.RepeatLayout == System.Web.UI.WebControls.RepeatLayout.Table)
{
info.Caption = this.Caption;
info.CaptionAlign = this.CaptionAlign;
info.UseAccessibleHeader = this.UseAccessibleHeader;
}
else
{
info.EnableLegacyRendering = base.EnableLegacyRendering;
}
}
info.RenderRepeater(writer, this, controlStyle, this);
if (table != null)
{
table.RenderEndTag(writer);
}
}
}
示例7: Render
protected internal override void Render(HtmlTextWriter writer)
{
bool isEnabled;
this.threadCalendar = DateTimeFormatInfo.CurrentInfo.Calendar;
this.minSupportedDate = this.threadCalendar.MinSupportedDateTime;
this.maxSupportedDate = this.threadCalendar.MaxSupportedDateTime;
DateTime visibleDate = this.EffectiveVisibleDate();
DateTime firstDay = this.FirstCalendarDay(visibleDate);
CalendarSelectionMode selectionMode = this.SelectionMode;
if (this.Page != null)
{
this.Page.VerifyRenderingInServerForm(this);
}
if ((this.Page == null) || base.DesignMode)
{
isEnabled = false;
}
else
{
isEnabled = base.IsEnabled;
}
this.defaultForeColor = this.ForeColor;
if (this.defaultForeColor == Color.Empty)
{
this.defaultForeColor = DefaultForeColor;
}
this.defaultButtonColorText = ColorTranslator.ToHtml(this.defaultForeColor);
Table table = new Table();
if (this.ID != null)
{
table.ID = this.ClientID;
}
table.CopyBaseAttributes(this);
if (base.ControlStyleCreated)
{
table.ApplyStyle(base.ControlStyle);
}
table.Width = this.Width;
table.Height = this.Height;
table.CellPadding = this.CellPadding;
table.CellSpacing = this.CellSpacing;
if ((!base.ControlStyleCreated || !base.ControlStyle.IsSet(0x20)) || this.BorderWidth.Equals(Unit.Empty))
{
table.BorderWidth = Unit.Pixel(1);
}
if (this.ShowGridLines)
{
table.GridLines = GridLines.Both;
}
else
{
table.GridLines = GridLines.None;
}
bool useAccessibleHeader = this.UseAccessibleHeader;
if (useAccessibleHeader && (table.Attributes["title"] == null))
{
table.Attributes["title"] = System.Web.SR.GetString("Calendar_TitleText");
}
string caption = this.Caption;
if (caption.Length > 0)
{
table.Caption = caption;
table.CaptionAlign = this.CaptionAlign;
}
table.RenderBeginTag(writer);
if (this.ShowTitle)
{
this.RenderTitle(writer, visibleDate, selectionMode, isEnabled, useAccessibleHeader);
}
if (this.ShowDayHeader)
{
this.RenderDayHeader(writer, visibleDate, selectionMode, isEnabled, useAccessibleHeader);
}
this.RenderDays(writer, firstDay, visibleDate, selectionMode, isEnabled, useAccessibleHeader);
table.RenderEndTag(writer);
}
示例8: 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)
);
}
//.........这里部分代码省略.........
示例9: Render
protected override void Render(HtmlTextWriter writer)
{
globCal = DateTimeFormatInfo.CurrentInfo.Calendar;
DateTime visDate = GetEffectiveVisibleDate();
DateTime firstDate = GetFirstCalendarDay(visDate);
bool isEnabled;
bool isHtmlTextWriter;
//FIXME: when Control.Site works, reactivate this
//if (Page == null || Site == null) {
// isEnabled = false;
// isHtmlTextWriter = false;
//} else {
isEnabled = Enabled;
isHtmlTextWriter = (writer.GetType() != typeof(HtmlTextWriter));
//}
defaultTextColor = ForeColor;
if(defaultTextColor == Color.Empty)
defaultTextColor = Color.Black;
Table calTable = new Table ();
calTable.ID = ID;
calTable.CopyBaseAttributes(this);
if(ControlStyleCreated)
calTable.ApplyStyle(ControlStyle);
calTable.Width = Width;
calTable.Height = Height;
calTable.CellSpacing = CellSpacing;
calTable.CellPadding = CellPadding;
if (ControlStyleCreated &&
ControlStyle.IsSet (WebControls.Style.BORDERWIDTH) &&
BorderWidth != Unit.Empty)
calTable.BorderWidth = BorderWidth;
else
calTable.BorderWidth = Unit.Pixel(1);
if (ShowGridLines)
calTable.GridLines = GridLines.Both;
else
calTable.GridLines = GridLines.None;
#if NET_2_0
calTable.Caption = Caption;
calTable.CaptionAlign = CaptionAlign;
#endif
calTable.RenderBeginTag (writer);
if (ShowTitle)
RenderTitle (writer, visDate, SelectionMode, isEnabled);
if (ShowDayHeader)
RenderHeader (writer, firstDate, SelectionMode, isEnabled, isHtmlTextWriter);
RenderAllDays (writer, firstDate, visDate, SelectionMode, isEnabled, isHtmlTextWriter);
calTable.RenderEndTag(writer);
}
示例10: RenderBeginTag_Empty
public void RenderBeginTag_Empty ()
{
HtmlTextWriter writer = GetWriter ();
Table t = new Table ();
t.RenderBeginTag (writer);
string s = writer.InnerWriter.ToString ();
#if NET_4_0
Assert.AreEqual ("<table>\n", s, "empty");
#else
Assert.AreEqual ("<table border=\"0\">\n", s, "empty");
#endif
}
示例11: RenderBeginTag_Caption
public void RenderBeginTag_Caption ()
{
HtmlTextWriter writer = GetWriter ();
Table t = new Table ();
t.Caption = "caption";
t.RenderBeginTag (writer);
string s = writer.InnerWriter.ToString ();
#if NET_4_0
Assert.AreEqual ("<table>\n\t<caption>\n\t\tcaption\n\t</caption>", s, "caption");
#else
Assert.AreEqual ("<table border=\"0\">\n\t<caption>\n\t\tcaption\n\t</caption>", s, "caption");
#endif
}
示例12: 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);
//.........这里部分代码省略.........
示例13: Render
/// <internalonly/>
/// <devdoc>
/// <para>Displays the <see cref='System.Web.UI.WebControls.Calendar'/> control on the client.</para>
/// </devdoc>
protected internal override void Render(HtmlTextWriter writer) {
threadCalendar = DateTimeFormatInfo.CurrentInfo.Calendar;
minSupportedDate = threadCalendar.MinSupportedDateTime;
maxSupportedDate = threadCalendar.MaxSupportedDateTime;
#if DEBUG
threadCalendarInitialized = true;
#endif
DateTime visibleDate = EffectiveVisibleDate();
DateTime firstDay = FirstCalendarDay(visibleDate);
CalendarSelectionMode selectionMode = SelectionMode;
// Make sure we are in a form tag with runat=server.
if (Page != null) {
Page.VerifyRenderingInServerForm(this);
}
// We only want to display the link if we have a page, or if we are on the design surface
// If we can stops links being active on the Autoformat dialog, then we can remove this these checks.
Page page = Page;
bool buttonsActive;
if (page == null || DesignMode) {
buttonsActive = false;
}
else {
buttonsActive = IsEnabled;
}
defaultForeColor = ForeColor;
if (defaultForeColor == Color.Empty) {
defaultForeColor = DefaultForeColor;
}
defaultButtonColorText = ColorTranslator.ToHtml(defaultForeColor);
Table table = new Table();
if (ID != null) {
table.ID = ClientID;
}
table.CopyBaseAttributes(this);
if (ControlStyleCreated) {
table.ApplyStyle(ControlStyle);
}
table.Width = Width;
table.Height = Height;
table.CellPadding = CellPadding;
table.CellSpacing = CellSpacing;
// default look
if ((ControlStyleCreated == false) ||
(ControlStyle.IsSet(System.Web.UI.WebControls.Style.PROP_BORDERWIDTH) == false) ||
BorderWidth.Equals(Unit.Empty)) {
table.BorderWidth = Unit.Pixel(1);
}
if (ShowGridLines) {
table.GridLines = GridLines.Both;
}
else {
table.GridLines = GridLines.None;
}
bool useAccessibleHeader = UseAccessibleHeader;
if (useAccessibleHeader) {
if (table.Attributes["title"] == null) {
table.Attributes["title"] = SR.GetString(SR.Calendar_TitleText);
}
}
string caption = Caption;
if (caption.Length > 0) {
table.Caption = caption;
table.CaptionAlign = CaptionAlign;
}
table.RenderBeginTag(writer);
if (ShowTitle) {
RenderTitle(writer, visibleDate, selectionMode, buttonsActive, useAccessibleHeader);
}
if (ShowDayHeader) {
RenderDayHeader(writer, visibleDate, selectionMode, buttonsActive, useAccessibleHeader);
}
RenderDays(writer, firstDay, visibleDate, selectionMode, buttonsActive, useAccessibleHeader);
table.RenderEndTag(writer);
}
示例14: RenderBeginTag_Empty
public void RenderBeginTag_Empty ()
{
HtmlTextWriter writer = GetWriter ();
Table t = new Table ();
t.RenderBeginTag (writer);
string s = writer.InnerWriter.ToString ();
Assert.AreEqual ("<table>\n", s, "empty");
}
示例15: RenderBeginTag_Row
public void RenderBeginTag_Row ()
{
HtmlTextWriter writer = GetWriter ();
Table t = new Table ();
t.Rows.Add (new TableRow ());
t.RenderBeginTag (writer);
string s = writer.InnerWriter.ToString ();
Assert.AreEqual ("<table border=\"0\">\n", s, "tr");
}