DetailsView.GridLines Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém ou define o estilo de grelha para um DetailsView controlo.
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
Valor de Propriedade
Um dos GridLines valores. A predefinição é GridLines.Both.
Exemplos
O exemplo de código seguinte demonstra como usar a GridLines propriedade para ocultar todas as linhas de grelha num DetailsView controlo.
<%@ 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>
Observações
Use a GridLines propriedade para especificar o estilo da grelha para um DetailsView controlo. A tabela seguinte lista os estilos disponíveis.
| Estilo | Description |
|---|---|
GridLines.None |
Não são exibidas linhas de grelha. |
GridLines.Horizontal |
Mostra apenas as linhas da grelha horizontal. |
GridLines.Vertical |
Mostra apenas as linhas da grelha vertical. |
GridLines.Both |
Mostra tanto as linhas de grelha horizontal como verticais. |