DetailsView.HorizontalAlign Özellik

Tanım

Sayfadaki bir DetailsView denetimin yatay hizalamasını alır veya ayarlar.

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

Özellik Değeri

HorizontalAlign

Değerlerden HorizontalAlign biri. Varsayılan değer: HorizontalAlign.NotSet.

Örnekler

Aşağıdaki kod örneği, bir DetailsView denetimin HorizontalAlign sayfada ortalanması gerektiğini belirtmek için özelliğinin nasıl kullanılacağını gösterir.


<%@ 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>

Açıklamalar

Bir denetimin HorizontalAlign sayfa içindeki yatay hizalamasını DetailsView belirtmek için özelliğini kullanın. Aşağıdaki tabloda farklı yatay hizalama stilleri listeleilmiştir.

HorizontalAlign değeri Description
HorizontalAlign.NotSet Denetimin DetailsView yatay hizalaması ayarlanmadı.
HorizontalAlign.Left Denetim DetailsView sayfada sola hizalanır.
HorizontalAlign.Center Denetim DetailsView sayfada ortalanır.
HorizontalAlign.Right Denetim DetailsView , sayfada sağa hizalanır.
HorizontalAlign.Justify Denetim DetailsView , sayfanın hem sol hem de sağ kenar boşluklarıyla hizalanır.

Şunlara uygulanır

Ayrıca bkz.