DetailsView.CommandRowStyle (Propiedad)
Ensamblado: System.Web (en system.web.dll)
Utilice la propiedad CommandRowStyle para controlar el aspecto de una fila de comandos de un control DetailsView. Una fila de comandos contiene los botones de comando necesarios para realizar operaciones como editar, eliminar e insertar. Aunque esta propiedad es de sólo lectura, puede establecer las propiedades del objeto TableItemStyle que devuelve. Las propiedades pueden establecerse mediante declaración con el formato Property-Subproperty, donde Subproperty es una propiedad del objeto TableItemStyle (por ejemplo, CommandRowStyle-ForeColor). Las propiedades también pueden establecerse mediante programación con el formato Property.Subproperty (por ejemplo, CommandRowStyle.ForeColor). Entre las opciones de configuración comunes se incluyen un color de fondo y un color de primer plano personalizados y las propiedades de fuente.
El ejemplo de código siguiente muestra cómo utilizar la propiedad CommandRowStyle para especificar la fuente y la configuración de estilo para la fila de comandos del control DetailsView.
<%@ 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 CommandRowStyle Example</title> </head> <body> <form id="Form1" runat="server"> <h3>DetailsView CommandRowStyle Example</h3> <asp:detailsview id="CustomerDetailsView" datasourceid="DetailsViewSource" autogeneraterows="false" datakeynames="CustomerID" gridlines="Both" allowpaging="true" runat="server"> <headerstyle backcolor="Navy" forecolor="White" /> <commandrowstyle backcolor="LightCyan" font-names="Arial" font-size="10" font-bold="true"/> <fields> <asp:commandfield ButtonType="Link" ShowEditButton="true"/> <asp:boundfield datafield="CustomerID" headertext="Customer ID" readonly="true"/> <asp:boundfield datafield="CompanyName" headertext="Company Name"/> <asp:boundfield datafield="Address" headertext="Address"/> <asp:boundfield datafield="City" headertext="City"/> <asp:boundfield datafield="PostalCode" headertext="Postal Code"/> <asp:boundfield datafield="Country" headertext="Country"/> </fields> </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 Service Pack 4, Windows CE, Windows Millennium, Windows Mobile para Pocket PC, Windows Mobile para Smartphone, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter
Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.