DetailsView.HorizontalAlign DetailsView.HorizontalAlign DetailsView.HorizontalAlign DetailsView.HorizontalAlign Property

Definizione

Ottiene o imposta l'allineamento orizzontale di un controllo DetailsView sulla pagina.Gets or sets the horizontal alignment of a DetailsView 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

Valore della proprietà

Uno dei valori di HorizontalAlign.One of the HorizontalAlign values. Il valore predefinito è HorizontalAlign.NotSet.The default is HorizontalAlign.NotSet.

Esempi

Nell'esempio di codice riportato di seguito viene illustrato HorizontalAlign come utilizzare la proprietà per DetailsView specificare che un controllo deve essere centrato sulla pagina.The following code example demonstrates how to use the HorizontalAlign property to specify that a DetailsView control should be centered on the 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>DetailsView HorizontalAlign Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView HorizontalAlign Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          autogeneraterows="true"
          allowpaging="true"
          horizontalalign="Center"  
          runat="server">
               
          <fieldheaderstyle backcolor="Navy"
            forecolor="White"/>
                    
        </asp:detailsview>
        
        <!-- 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="DetailsViewSource" runat="server" 
          ConnectionString=
            "<%$ ConnectionStrings:NorthWindConnectionString%>"
          InsertCommand="INSERT INTO [Customers]([CustomerID],
            [CompanyName], [Address], [City], [PostalCode], [Country]) 
            VALUES (@CustomerID, @CompanyName, @Address, @City, 
            @PostalCode, @Country)"

          SelectCommand="Select [CustomerID], [CompanyName], 
            [Address], [City], [PostalCode], [Country] From 
            [Customers]">
        </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>DetailsView HorizontalAlign Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView HorizontalAlign Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          autogeneraterows="true"
          allowpaging="true"
          horizontalalign="Center"  
          runat="server">
               
          <fieldheaderstyle backcolor="Navy"
            forecolor="White"/>
                    
        </asp:detailsview>
        
        <!-- 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="DetailsViewSource" runat="server" 
          ConnectionString=
            "<%$ ConnectionStrings:NorthWindConnectionString%>"
          InsertCommand="INSERT INTO [Customers]([CustomerID],
            [CompanyName], [Address], [City], [PostalCode], [Country]) 
            VALUES (@CustomerID, @CompanyName, @Address, @City, 
            @PostalCode, @Country)"

          SelectCommand="Select [CustomerID], [CompanyName], 
            [Address], [City], [PostalCode], [Country] From 
            [Customers]">
        </asp:SqlDataSource>
    </form>
  </body>
</html>

Commenti

Utilizzare la HorizontalAlign proprietà per specificare l'allineamento orizzontale di un DetailsView controllo all'interno della pagina.Use the HorizontalAlign property to specify the horizontal alignment of a DetailsView control within the page. Nella tabella seguente sono elencati i diversi stili di allineamento orizzontale.The following table lists the different horizontal alignment styles.

Valore HorizontalAlignHorizontalAlign value DescriptionDescription
HorizontalAlign.NotSet L'allineamento orizzontale del DetailsView controllo non è stato impostato.The horizontal alignment of the DetailsView control has not been set.
HorizontalAlign.Left Il DetailsView controllo è allineato a sinistra nella pagina.The DetailsView control is left-aligned on the page.
HorizontalAlign.Center Il DetailsView controllo è centrato sulla pagina.The DetailsView control is centered on the page.
HorizontalAlign.Right Il DetailsView controllo è allineato a destra nella pagina.The DetailsView control is right-aligned on the page.
HorizontalAlign.Justify Il DetailsView controllo è allineato ai margini destro e sinistro della pagina.The DetailsView control is aligned with both the left and right margins of the page.

Si applica a

Vedi anche