DetailsView.GridLines Property
.NET Framework (current version)
Gets or sets the gridline style for a DetailsView control.
Assembly: System.Web (in System.Web.dll)
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="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>
.NET Framework
Available since 2.0
Available since 2.0
Show: