asp.net.ph

VerticalAlign Enumeration

System.Web.UI.WebControls Namespace


Specifies the vertical alignment of an object within a control.

Remarks

The VerticalAlign enumeration represents the vertical alignment options for an item relative to its container control.

Members


Member Name Description
Bottom The contents are aligned with the bottom edge of the enclosing control.
Middle The contents are aligned with the vertical middle of the enclosing control.
Top The contents are aligned with the top edge of the enclosing control.
NotSet The vertical alignment is not set.

Example

The sample below shows how to programmatically set the VerticalAlign property of a DataGrid 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_alignEnum = 
         TypeDescriptor.GetConverter ( typeof ( VerticalAlign ) ).GetStandardValues ( );
      foreach ( VerticalAlign v in v_alignEnum ) {
         AlignSelect.Items.Add ( v.ToString ( ) );
      }
      AlignSelect.SelectedIndex = 2;

      string query = "SELECT Lastname, Firstname, Address, City, Country FROM Employees";
      myGrid.DataSource = fetchData ( query, "northwind" );
      myGrid.DataBind ( );
   }
   myGrid.ItemStyle.VerticalAlign = ( VerticalAlign ) AlignSelect.SelectedIndex;
}

 Show me 

See Also

HorizontalAlign Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph