本文整理汇总了C#中System.Web.UI.WebControls.WebControl.AddControlsReturnThis方法的典型用法代码示例。如果您正苦于以下问题:C# WebControl.AddControlsReturnThis方法的具体用法?C# WebControl.AddControlsReturnThis怎么用?C# WebControl.AddControlsReturnThis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.WebControl
的用法示例。
在下文中一共展示了WebControl.AddControlsReturnThis方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildRows
internal static IEnumerable<Control> BuildRows(
List<List<CellPlaceholder>> cellPlaceholderListsForRows, IReadOnlyList<EwfTableFieldOrItemSetup> rowSetups, bool? useContrastForFirstRow,
IReadOnlyList<EwfTableFieldOrItemSetup> columns, int firstDataColumnIndex, bool tableIsColumnPrimary)
{
return cellPlaceholderListsForRows.Select(
( row, rowIndex ) => {
var rowControl = new WebControl( HtmlTextWriterTag.Tr );
var rowClickScript = rowSetups[ rowIndex ].ClickScript;
if( rowClickScript != null )
rowClickScript.SetUpClickableControl( rowControl );
rowControl.Height = rowSetups[ rowIndex ].Size;
rowControl.CssClass =
rowControl.CssClass.ConcatenateWithSpace(
useContrastForFirstRow.HasValue && ( ( rowIndex % 2 == 1 ) ^ useContrastForFirstRow.Value ) ? EwfTable.CssElementCreator.ContrastClass : "" );
rowControl.CssClass = rowControl.CssClass.ConcatenateWithSpace( StringTools.ConcatenateWithDelimiter( " ", rowSetups[ rowIndex ].Classes.ToArray() ) );
return
new NamingPlaceholder(
rowControl.AddControlsReturnThis(
row.Select( ( cell, colIndex ) => new { Cell = cell as EwfTableCell, ColumnIndex = colIndex } )
.Where( cellAndIndex => cellAndIndex.Cell != null )
.Select(
cellAndIndex => {
var cellControl = new WebControl( cellAndIndex.ColumnIndex < firstDataColumnIndex ? HtmlTextWriterTag.Th : HtmlTextWriterTag.Td );
var rowSpan = tableIsColumnPrimary ? cellAndIndex.Cell.Setup.FieldSpan : cellAndIndex.Cell.Setup.ItemSpan;
if( rowSpan != 1 )
cellControl.Attributes.Add( "rowspan", rowSpan.ToString() );
var colSpan = tableIsColumnPrimary ? cellAndIndex.Cell.Setup.ItemSpan : cellAndIndex.Cell.Setup.FieldSpan;
if( colSpan != 1 )
cellControl.Attributes.Add( "colspan", colSpan.ToString() );
var rowSetup = rowSetups[ rowIndex ];
var columnSetup = columns[ cellAndIndex.ColumnIndex ];
var clickScript = cellAndIndex.Cell.Setup.ClickScript ?? ( tableIsColumnPrimary || rowSetup.ClickScript == null ? columnSetup.ClickScript : null );
if( clickScript != null )
clickScript.SetUpClickableControl( cellControl );
var columnClassString = StringTools.ConcatenateWithDelimiter( " ", columnSetup.Classes.ToArray() );
var cellClassString = StringTools.ConcatenateWithDelimiter( " ", cellAndIndex.Cell.Setup.Classes.ToArray() );
cellControl.CssClass = StringTools.ConcatenateWithDelimiter(
" ",
cellControl.CssClass,
EwfTable.CssElementCreator.AllCellAlignmentsClass,
textAlignmentClass( cellAndIndex.Cell, rowSetup, columnSetup ),
verticalAlignmentClass( rowSetup, columnSetup ),
columnClassString,
cellClassString );
if( ( rowSetup.ToolTipControl != null || rowSetup.ToolTip.Length > 0 ) && cellAndIndex.ColumnIndex == 0 )
new ToolTip( rowSetup.ToolTipControl ?? ToolTip.GetToolTipTextControl( rowSetup.ToolTip ), rowControl );
if( columnSetup.ToolTipControl != null )
throw new ApplicationException( "A column cannot have a tool tip control because there is no way to clone this control to put it on every cell." );
if( columnSetup.ToolTip.Length > 0 )
new ToolTip( ToolTip.GetToolTipTextControl( columnSetup.ToolTip ), cellControl );
if( cellAndIndex.Cell.Setup.ToolTipControl != null || cellAndIndex.Cell.Setup.ToolTip.Length > 0 )
new ToolTip( cellAndIndex.Cell.Setup.ToolTipControl ?? ToolTip.GetToolTipTextControl( cellAndIndex.Cell.Setup.ToolTip ), cellControl );
return cellControl.AddControlsReturnThis( cellAndIndex.Cell.Controls ) as Control;
} ) ).ToSingleElementArray() );
} );
}
示例2: widthSetter
WebControl ActionControlStyle.SetUpControl( WebControl control, string defaultText, Unit width, Unit height, Action<Unit> widthSetter )
{
widthSetter( width );
var cssElement = CssElementCreator.NormalButtonStyleClass;
if( buttonSize == ButtonSize.ShrinkWrap )
cssElement = CssElementCreator.ShrinkWrapButtonStyleClass;
else if( buttonSize == ButtonSize.Large )
cssElement = CssElementCreator.LargeButtonStyleClass;
control.CssClass = control.CssClass.ConcatenateWithSpace( CssElementCreator.AllStylesClass + " " + cssElement );
return control.AddControlsReturnThis( ActionControlIcon.GetIconAndTextControls( icon, text.Any() ? text : defaultText ) );
}
示例3:
WebControl ActionControlStyle.SetUpControl( WebControl control, string defaultText, Unit width, Unit height, Action<Unit> widthSetter )
{
control.CssClass = control.CssClass.ConcatenateWithSpace( CssElementCreator.AllStylesClass + " " + CssElementCreator.TextStyleClass );
return control.AddControlsReturnThis( ActionControlIcon.GetIconAndTextControls( icon, Text.Any() ? Text : defaultText ) );
}