Export (0) Print
Expand All

DetailsView.GridLines Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets the gridline style for a DetailsView control.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public virtual GridLines GridLines { get; set; }
/** @property */
public GridLines get_GridLines ()

/** @property */
public void set_GridLines (GridLines value)

public function get GridLines () : GridLines

public function set GridLines (value : GridLines)

Property Value

One of the GridLines values. The default is GridLines.Both.

Use the GridLines property to specify the gridline style for a DetailsView control. The following table lists the available styles.

Style

Description

GridLines.None

No gridlines are displayed.

GridLines.Horizontal

Displays the horizontal gridlines only.

GridLines.Vertical

Displays the vertical gridlines only.

GridLines.Both

Displays both the horizontal and vertical gridlines.

The following code example demonstrates how to use the GridLines property to hide all gridlines in a DetailsView control.


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

<html>
  <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>


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft