Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

GridView.GridLines Property

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

Gets or sets the gridline style for a GridView 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 GridView 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 the gridlines in a GridView control.


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

<html>
  <body>
    <form runat="server">
        
      <h3>GridView GridLines Example</h3>
      
      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSqlDataSource" 
        autogeneratecolumns="true"
        gridlines="None"
        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>


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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.