GridView.HorizontalAlign GridView.HorizontalAlign GridView.HorizontalAlign GridView.HorizontalAlign Property

Definición

Obtiene o establece la alineación horizontal de un control GridView en la página.Gets or sets the horizontal alignment of a GridView control on the page.

public:
 virtual property System::Web::UI::WebControls::HorizontalAlign HorizontalAlign { System::Web::UI::WebControls::HorizontalAlign get(); void set(System::Web::UI::WebControls::HorizontalAlign value); };
public virtual System.Web.UI.WebControls.HorizontalAlign HorizontalAlign { get; set; }
member this.HorizontalAlign : System.Web.UI.WebControls.HorizontalAlign with get, set
Public Overridable Property HorizontalAlign As HorizontalAlign

Valor de propiedad

Uno de los valores de HorizontalAlign.One of the HorizontalAlign values. De manera predeterminada, es HorizontalAlign.NotSet.The default is HorizontalAlign.NotSet.

Ejemplos

En el ejemplo siguiente se muestra cómo utilizar HorizontalAlign la propiedad para alinear un GridView control en el lado derecho de una página.The following example demonstrates how to use the HorizontalAlign property to align a GridView control on the right side of a page.


<%@ Page language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>GridView HorizontalAlign Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>GridView HorizontalAlign Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSqlDataSource" 
        autogeneratecolumns="true"
        horizontalalign="Right"
        runat="server">
      </asp:gridview>
            
      <!-- This example uses Microsoft SQL Server and connects  -->
      <!-- to the Northwind sample database. Use an ASP.NET     -->
      <!-- expression to retrieve the connection string value   -->
      <!-- from the Web.config file.                            -->
      <asp:sqldatasource id="CustomersSqlDataSource"  
        selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
        runat="server">
      </asp:sqldatasource>
            
    </form>
  </body>
</html>


<%@ Page language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>GridView HorizontalAlign Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>GridView HorizontalAlign Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSqlDataSource" 
        autogeneratecolumns="true"
        horizontalalign="Right"
        runat="server">
      </asp:gridview>
            
      <!-- This example uses Microsoft SQL Server and connects  -->
      <!-- to the Northwind sample database. Use an ASP.NET     -->
      <!-- expression to retrieve the connection string value   -->
      <!-- from the Web.config file.                            -->
      <asp:sqldatasource id="CustomersSqlDataSource"  
        selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
        runat="server">
      </asp:sqldatasource>
            
    </form>
  </body>
</html>

Comentarios

Utilice la HorizontalAlign propiedad para especificar la alineación horizontal de un GridView control dentro de la página.Use the HorizontalAlign property to specify the horizontal alignment of a GridView control within the page. En la tabla siguiente se enumeran los distintos estilos de alineación horizontal.The following table lists the different horizontal alignment styles.

Valor de alineaciónAlignment value DescripciónDescription
HorizontalAlign.NotSet No se ha establecido la GridView alineación horizontal del control.The horizontal alignment of the GridView control has not been set.
HorizontalAlign.Left El GridView control se alinea a la izquierda en la página.The GridView control is left-aligned on the page.
HorizontalAlign.Center El GridView control está centrado en la página.The GridView control is centered on the page.
HorizontalAlign.Right El GridView control está alineado a la derecha en la página.The GridView control is right-aligned on the page.
HorizontalAlign.Justify El GridView control se alinea con los márgenes izquierdo y derecho de la página.The GridView control is aligned with both the left and right margins of the page.

Se aplica a

Consulte también: