DetailsView.GridLines Proprietà

Definizione

Ottiene o imposta lo stile delle linee della griglia di un controllo DetailsView.

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

Valore della proprietà

Uno dei valori di GridLines. Il valore predefinito è GridLines.Both.

Esempio

Nell'esempio di codice seguente viene illustrato come usare la GridLines proprietà per nascondere tutte le linee di griglia in un DetailsView controllo.


<%@ 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 GridLines Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView GridLines Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          autogeneraterows="true"
          allowpaging="true"
          gridlines="None"  
          runat="server">
               
          <headerstyle 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 GridLines Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView GridLines Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          autogeneraterows="true"
          allowpaging="true"
          gridlines="None"  
          runat="server">
               
          <headerstyle 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 GridLines proprietà per specificare lo stile griglia per un DetailsView controllo. Nella tabella seguente sono elencati gli stili disponibili.

Stile Descrizione
GridLines.None Non vengono visualizzate linee di griglia.
GridLines.Horizontal Visualizza solo le linee di griglia orizzontale.
GridLines.Vertical Visualizza solo le linee di griglia verticale.
GridLines.Both Visualizza sia le linee di griglia orizzontale che verticale.

Si applica a

Vedi anche