DetailsView.InsertRowStyle Property
Assembly: System.Web (in system.web.dll)
The data rows in the DetailsView control are displayed using this style when the DetailsView control is in insert mode. Use the InsertRowStyle property to control the appearance of the data rows in insert mode. This property is read-only; however, you can set the properties of the TableItemStyle object it returns. The properties can be set declaratively in the form Property-Subproperty, where Subproperty is a property of the TableItemStyle object (for example, InsertRowStyle-ForeColor). The properties can also be set programmatically in the form Property.Subproperty (for example, InsertRowStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.
The following code example demonstrates how to use the InsertRowStyle property to specify the font and style settings for the data rows when the DetailsView control is in insert mode.
<%@ 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 InsertRowStyle Example</title> </head> <body> <form id="Form1" runat="server"> <h3>DetailsView InsertRowStyle Example</h3> <asp:detailsview id="CustomerDetailView" datasourceid="DetailsViewSource" datakeynames="CustomerID" autogenerateinsertbutton="true" autogeneraterows="true" allowpaging="true" runat="server"> <fieldheaderstyle backcolor="Navy" forecolor="White"/> <insertrowstyle backcolor="Yellow"/> </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>
Reference
DetailsView ClassDetailsView Members
System.Web.UI.WebControls Namespace
TableItemStyle
DetailsView.AlternatingRowStyle Property
DetailsView.CommandRowStyle Property
DetailsView.EditRowStyle Property
DetailsView.EmptyDataRowStyle Property
DetailsView.FooterStyle Property
DetailsView.FieldHeaderStyle Property
DetailsView.HeaderStyle Property
RowStyle