ASP.NET DetailsView HeaderTemplate, HeaderStyle and AlternatingRowStyle

asp.net DetailsView HeaderTemplate, HeaderStyle, AlternatingRowStyle example
DetailsViewStyle.aspx
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>asp.net DetailsView HeaderTemplate, HeaderStyle, AlternatingRowStyle example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Fuchsia">DetailsView Style Example</h2>
        <asp:SqlDataSource
             ID="SqlDataSource1"
             runat="server"
             ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
             SelectCommand="SELECT TOP 6 EmployeeID, LastName, FirstName, City FROM Employees"
             >
        </asp:SqlDataSource>
        <asp:DetailsView
             ID="DetailsView1" 
             runat="server"
             DataSourceID="SqlDataSource1"
             AutoGenerateRows="false"
             BackColor="Azure"
             ForeColor="LightSeaGreen"
             BorderColor="LightSlateGray"
             AllowPaging="true"
             >
             <Fields>
                <asp:BoundField HeaderText="Employee ID" DataField="EmployeeID" />
                <asp:BoundField HeaderText="First Name" DataField="FirstName" />
                <asp:BoundField HeaderText="Last Name" DataField="LastName" />
                <asp:BoundField HeaderText="City" DataField="City" />
            </Fields>
            <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
            <PagerStyle BackColor="AliceBlue" ForeColor="HotPink" />
            <HeaderStyle BackColor="LightSteelBlue" ForeColor="LightSlateGray" HorizontalAlign="Center" />
            <HeaderTemplate>
                <asp:Label ID="Label1" runat="server" Text="Employee" Font-Size="Large"></asp:Label>
            </HeaderTemplate>
            <AlternatingRowStyle BackColor="Beige" />
        </asp:DetailsView>
    </div>
    </form>
</body>
</html>






Related asp.net example