System.Web.UI.WebControls Namespace TableRow Class
Sets or retrieves the vertical alignment of the contents in the row.
Inline |
<asp:tablerow verticalalign = enumValue ... > |
Script |
TableRow.VerticalAlign [ = enumValue ] |
The property is read/write with a default value of NotSet.
Use the VerticalAlign property to specify the vertical alignment of the contents of the row. This property is set with one of the VerticalAlign enumeration values.
The sample below shows how to programmatically set the VerticalAlign property of a TableRow at run time, depending on user input. The code also demonstrates how simple it is to retrieve the available system vertical align styles and dynamically add each to a selectable list.
void Page_Load ( Object src, EventArgs e ) {
if ( !IsPostBack ) {
ICollection v_aligns =
TypeDescriptor.GetConverter ( typeof ( VerticalAlign ) ).GetStandardValues ( );
foreach ( VerticalAlign v in v_aligns ) {
AlignSelect.Items.Add ( v.ToString ( ) );
}
AlignSelect.SelectedIndex = 2;
}
myRow.VerticalAlign = ( VerticalAlign ) AlignSelect.SelectedIndex;
}
Sub Page_Load ( src As Object, e As EventArgs )
If Not IsPostBack Then
Dim v_aligns As ICollection = _
TypeDescriptor.GetConverter ( GetType ( VerticalAlign ) ).GetStandardValues ( )
Dim v As VerticalAlign
For Each v In v_aligns
AlignSelect.Items.Add ( v.ToString ( ) )
Next v
AlignSelect.SelectedIndex = 2
End If
myRow.VerticalAlign = CType ( AlignSelect.SelectedIndex, VerticalAlign )
End Sub |
|
C# |
VB |
TableRow Members