FormView.GridLines Propriedade
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Obtém ou define o estilo das linhas de grade para um controle FormView.
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 da propriedade
Um dos valores de GridLines. O padrão é GridLines.None
.
Exemplos
O exemplo a seguir demonstra como usar a GridLines propriedade para exibir as linhas de grade vertical e horizontal.
<%@ 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>FormView Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>FormView Example</h3>
<asp:formview id="EmployeeFormView"
datasourceid="EmployeeSource"
allowpaging="true"
datakeynames="EmployeeID"
cellpadding="10"
cellspacing="20"
gridlines="Both"
runat="server">
<itemtemplate>
<table>
<tr>
<td>
<asp:image id="EmployeeImage"
imageurl='<%# Eval("PhotoPath") %>'
alternatetext='<%# Eval("LastName") %>'
runat="server"/>
</td>
<td>
<h3><%# Eval("FirstName") %> <%# Eval("LastName") %></h3>
<%# Eval("Title") %>
</td>
</tr>
</table>
</itemtemplate>
<pagersettings position="Bottom"
mode="NextPrevious"/>
</asp:formview>
<!-- 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="EmployeeSource"
selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees]"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server"/>
</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>FormView Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>FormView Example</h3>
<asp:formview id="EmployeeFormView"
datasourceid="EmployeeSource"
allowpaging="true"
datakeynames="EmployeeID"
cellpadding="10"
cellspacing="20"
gridlines="Both"
runat="server">
<itemtemplate>
<table>
<tr>
<td>
<asp:image id="EmployeeImage"
imageurl='<%# Eval("PhotoPath") %>'
alternatetext='<%# Eval("LastName") %>'
runat="server"/>
</td>
<td>
<h3><%# Eval("FirstName") %> <%# Eval("LastName") %></h3>
<%# Eval("Title") %>
</td>
</tr>
</table>
</itemtemplate>
<pagersettings position="Bottom"
mode="NextPrevious"/>
</asp:formview>
<!-- 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="EmployeeSource"
selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees]"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server"/>
</form>
</body>
</html>
Comentários
Use a GridLines propriedade para especificar o estilo de linha de grade para um FormView controle. A tabela a seguir lista os estilos disponíveis.
Estilo | Descrição |
---|---|
GridLines.None |
Nenhuma linha de grade é exibida. |
GridLines.Horizontal |
Exibe somente as linhas de grade horizontais. |
GridLines.Vertical |
Exibe somente as linhas de grade verticais. |
GridLines.Both |
Exibe as linhas de grade horizontal e vertical. |