<%@ Page Language="VB" AutoEventWireup="false" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="SqlDataSource1"
runat="server" ConnectionString="YourConnectionString"
SelectCommand="SELECT * FROM [Books]"></asp:SqlDataSource>
</div>
<asp:DetailsView ID="DetailsView1"
runat="server"
AllowPaging="True"
AutoGenerateRows="False"
BackColor="LightGoldenrodYellow"
BorderColor="Tan"
BorderWidth="1px"
CellPadding="2"
DataKeyNames= "BookID"
DataSourceID="SqlDataSource1"
ForeColor="Black"
GridLines="None"
Height="50px"
Width="125px">
<PagerSettings Mode="NextPrevious" NextPageText="Next &gt;" PreviousPageText="&lt; Previous" />
<FooterStyle BackColor="Tan" />
<EditRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
<Fields>
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="Author" HeaderText="Author" SortExpression="Author" />
<asp:BoundField DataField="PageCount" HeaderText="Pages" SortExpression="PageCount" />
<asp:BoundField DataField="YearPublished" HeaderText="Published" SortExpression="YearPublished" />
<asp:BoundField DataField="Price" DataFormatString="{0:c}" HeaderText="Price" HtmlEncode="False"
SortExpression="Price" />
<asp:BoundField DataField="LastReadOn" DataFormatString="{0:d}" HeaderText="Last Read"
HtmlEncode="False" SortExpression="LastReadOn" />
</Fields>
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<AlternatingRowStyle BackColor="PaleGoldenrod" />
</asp:DetailsView>
<br />
</form>
</body>
</html>
File: Web.config
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MyFirstDatabase.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
|