.master代码如下:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="A_7_1_DataControlShow.master.cs" Inherits="A_7_1_DataControlShow" %>
<!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></title>
<link href="CSS_default.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1 class ="h1ttl">数据控件演示</h1>
<asp:BulletedList ID="blist_menu" runat="server" DisplayMode="HyperLink" CssClass ="blist_menu">
<asp:ListItem Value ="1_gridviewshow.aspx">GridView演示</asp:ListItem>
<asp:ListItem Value ="2_datalistshow.aspx">DataList演示</asp:ListItem>
<asp:ListItem Value ="3_DetailsViewshow.aspx">DetailsView演示</asp:ListItem>
<asp:ListItem Value ="4_FormViewshow.aspx">FormView演示</asp:ListItem>
<asp:ListItem Value ="5_ListViewshow.aspx">ListView演示</asp:ListItem>
</asp:BulletedList>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
gridview.aspx代码如下:
<%@ Page Title="" Language="C#" MasterPageFile="~/A_7_1_DataControlShow.master" AutoEventWireup="true" CodeFile="1_gridviewshow.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h2 class="h2ttl">1.GridView演示</h2>
<div>
<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False" CellPadding="2" DataKeyNames="news_id"
DataSourceID="ADS_NEWS" ForeColor="Black" GridLines="None"
BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px">
<AlternatingRowStyle BackColor="PaleGoldenrod" />
<Columns>
<asp:BoundField DataField="news_id" HeaderText="编号" InsertVisible="False"
ReadOnly="True" SortExpression="news_id" />
<asp:BoundField DataField="news_ttl" HeaderText="标题"
SortExpression="news_ttl" />
<asp:BoundField DataField="news_date" HeaderText="日期"
SortExpression="news_date" />
<asp:BoundField DataField="news_content" HeaderText="内容"
SortExpression="news_content" />
<asp:BoundField DataField="news_order" HeaderText="排序"
SortExpression="news_order" />
<asp:CheckBoxField DataField="news_enable" HeaderText="有效新闻"
SortExpression="news_enable" />
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ButtonType="Button" />
</Columns>
<FooterStyle BackColor="Tan" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue"
HorizontalAlign="Center" />
<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<SortedAscendingCellStyle BackColor="#FAFAE7" />
<SortedAscendingHeaderStyle BackColor="#DAC09E" />
<SortedDescendingCellStyle BackColor="#E1DB9C" />
<SortedDescendingHeaderStyle BackColor="#C2A47B" />
</asp:GridView>
<asp:AccessDataSource ID="ADS_NEWS" runat="server" DataFile="~/mdb/mydb.mdb"
DeleteCommand="DELETE FROM [t_news_mng] WHERE [news_id] = ?"
InsertCommand="INSERT INTO [t_news_mng] ([news_id], [news_ttl], [news_date], [news_content], [news_order], [news_enable]) VALUES (?, ?, ?, ?, ?, ?)"
SelectCommand="SELECT * FROM [t_news_mng]"
UpdateCommand="UPDATE [t_news_mng] SET [news_ttl] = ?, [news_date] = ?, [news_content] = ?, [news_order] = ?, [news_enable] = ? WHERE [news_id] = ?">
<DeleteParameters>
<asp:Parameter Name="news_id" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="news_id" Type="Int32" />
<asp:Parameter Name="news_ttl" Type="String" />
<asp:Parameter Name="news_date" Type="DateTime" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_order" Type="Int32" />
<asp:Parameter Name="news_enable" Type="Boolean" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="news_ttl" Type="String" />
<asp:Parameter Name="news_date" Type="DateTime" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_order" Type="Int32" />
<asp:Parameter Name="news_enable" Type="Boolean" />
<asp:Parameter Name="news_id" Type="Int32" />
</UpdateParameters>
</asp:AccessDataSource>
</div>
</asp:Content>
datalist.aspx代码如下:
<%@ Page Title="" Language="C#" MasterPageFile="~/A_7_1_DataControlShow.master" AutoEventWireup="true" CodeFile="2_datalistshow.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div>
<h2 class ="h2ttl">2. DataList显示数据</h2>
<p class="pMemo">DataList中显示的模版可<span style ="color:red;">以任意定义</span>,并非只能以这样块状的显示。</p>
<div >
<%-- 第一种DataList显示方式--%>
<div id="dlist1" class="fl" style ="width:300px;">
<asp:DataList ID="DataList1" runat="server" CellPadding="4"
DataKeyField="news_id" DataSourceID="AccessDataSource1" ForeColor="#333333">
<AlternatingItemStyle BackColor="White" />
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<ItemStyle BackColor="#FFFBD6" ForeColor="#333333" />
<ItemTemplate>
news_id:
<asp:Label ID="news_idLabel" runat="server" Text='<%# Eval("news_id") %>' />
<br />
news_ttl:
<asp:Label ID="news_ttlLabel" runat="server" Text='<%# Eval("news_ttl") %>' />
<br />
news_date:
<asp:Label ID="news_dateLabel" runat="server" Text='<%# Eval("news_date") %>' />
<br />
news_content:
<asp:Label ID="news_contentLabel" runat="server"
Text='<%# Eval("news_content") %>' />
<br />
news_order:
<asp:Label ID="news_orderLabel" runat="server"
Text='<%# Eval("news_order") %>' />
<br />
news_enable:
<asp:Label ID="news_enableLabel" runat="server"
Text='<%# Eval("news_enable") %>' />
<br />
<br />
</ItemTemplate>
<SelectedItemStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
</asp:DataList>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/mdb/mydb.mdb" SelectCommand="SELECT * FROM [t_news_mng]">
</asp:AccessDataSource>
</div>
<%-- 第二种DataList显示方式--%>
<div class ="fr" style ="width:300px;">
<asp:DataList ID="DataList2" runat="server" DataKeyField="news_id"
DataSourceID="AccessDataSource1">
<ItemTemplate>
新闻编号:
<asp:Label ID="news_idLabel" runat="server" Text='<%# Eval("news_id") %>' />
<br />
<asp:Label ID="news_ttlLabel" runat="server" Text='<%# Eval("news_ttl") %>' /> <br />
<asp:Label ID="news_dateLabel" runat="server" Text='<%# Eval("news_date") %>' />
<br />
排序:
<asp:Label ID="news_orderLabel" runat="server"
Text='<%# Eval("news_order") %>' />
<br />
有效性:
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%#Eval("news_enable") %>' Enabled="false" />
<br />
<hr />
</ItemTemplate>
</asp:DataList>
</div>
<div class="clr"></div>
</div>
</div>
</asp:Content>
detailsviewshow.aspx代码如下:
<%@ Page Title="" Language="C#" MasterPageFile="~/A_7_1_DataControlShow.master" AutoEventWireup="true" CodeFile="3_detailsviewshow.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div>
<h2 class ="h2ttl">3. DetailsVies显示数据</h2>
<p class ="pMemo">在这个控件中,我们勾选了数据新增、编辑、排序的功能。</p>
<div>
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="506px"
AllowPaging="True" AutoGenerateRows="False" BackColor="White"
BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3"
DataKeyNames="news_id" DataSourceID="AccessDataSource1" GridLines="Vertical">
<AlternatingRowStyle BackColor="#DCDCDC" />
<EditRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<Fields>
<asp:BoundField DataField="news_id" HeaderText="编号" InsertVisible="False"
ReadOnly="True" SortExpression="news_id" />
<asp:BoundField DataField="news_ttl" HeaderText="标题"
SortExpression="news_ttl" />
<asp:BoundField DataField="news_date" HeaderText="日期"
SortExpression="news_date" />
<asp:BoundField DataField="news_content" HeaderText="内容"
SortExpression="news_content" />
<asp:BoundField DataField="news_order" HeaderText="排序"
SortExpression="news_order" />
<asp:CheckBoxField DataField="news_enable" HeaderText="有效性"
SortExpression="news_enable" />
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ShowInsertButton="True" />
</Fields>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
</asp:DetailsView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/mdb/mydb.mdb"
DeleteCommand="DELETE FROM [t_news_mng] WHERE [news_id] = ?"
InsertCommand="INSERT INTO [t_news_mng] ([news_ttl], [news_date], [news_content], [news_order], [news_enable]) VALUES (?, ?, ?, ?, ?)"
SelectCommand="SELECT * FROM [t_news_mng]"
UpdateCommand="UPDATE [t_news_mng] SET [news_ttl] = ?, [news_date] = ?, [news_content] = ?, [news_order] = ?, [news_enable] = ? WHERE [news_id] = ?">
<DeleteParameters>
<asp:Parameter Name="news_id" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="news_ttl" Type="String" />
<asp:Parameter Name="news_date" Type="DateTime" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_order" Type="Int32" />
<asp:Parameter Name="news_enable" Type="Boolean" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="news_ttl" Type="String" />
<asp:Parameter Name="news_date" Type="DateTime" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_order" Type="Int32" />
<asp:Parameter Name="news_enable" Type="Boolean" />
<asp:Parameter Name="news_id" Type="Int32" />
</UpdateParameters>
</asp:AccessDataSource>
</div>
</div>
</asp:Content>
formviewshow.aspx代码如下:
<%@ Page Title="" Language="C#" MasterPageFile="~/A_7_1_DataControlShow.master" AutoEventWireup="true" CodeFile="4_formviewshow.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h2 class="h2ttl">4.FormView演示</h2>
<asp:FormView ID="FormView1" runat="server" AllowPaging="True"
BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"
CellPadding="3" DataKeyNames="news_id" DataSourceID="AccessDataSource1"
ForeColor="Black" GridLines="Vertical" Width="405px">
<EditItemTemplate>
news_id:
<asp:Label ID="news_idLabel1" runat="server" Text='<%# Eval("news_id") %>' />
<br />
news_ttl:
<asp:TextBox ID="news_ttlTextBox" runat="server"
Text='<%# Bind("news_ttl") %>' />
<br />
news_date:
<asp:TextBox ID="news_dateTextBox" runat="server"
Text='<%# Bind("news_date") %>' />
<br />
news_content:
<asp:TextBox ID="news_contentTextBox" runat="server"
Text='<%# Bind("news_content") %>' />
<br />
news_order:
<asp:TextBox ID="news_orderTextBox" runat="server"
Text='<%# Bind("news_order") %>' />
<br />
news_enable:
<asp:CheckBox ID="news_enableCheckBox" runat="server"
Checked='<%# Bind("news_enable") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="更新" />
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="取消" />
</EditItemTemplate>
<EditRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<FooterStyle BackColor="#CCCCCC" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<InsertItemTemplate>
news_ttl:
<asp:TextBox ID="news_ttlTextBox" runat="server"
Text='<%# Bind("news_ttl") %>' />
<br />
news_date:
<asp:TextBox ID="news_dateTextBox" runat="server"
Text='<%# Bind("news_date") %>' />
<br />
news_content:
<asp:TextBox ID="news_contentTextBox" runat="server"
Text='<%# Bind("news_content") %>' />
<br />
news_order:
<asp:TextBox ID="news_orderTextBox" runat="server"
Text='<%# Bind("news_order") %>' />
<br />
news_enable:
<asp:CheckBox ID="news_enableCheckBox" runat="server"
Checked='<%# Bind("news_enable") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="插入" />
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="取消" />
</InsertItemTemplate>
<ItemTemplate>
news_id:
<asp:Label ID="news_idLabel" runat="server" Text='<%# Eval("news_id") %>' />
<br />
news_ttl:
<asp:Label ID="news_ttlLabel" runat="server" Text='<%# Bind("news_ttl") %>' />
<br />
news_date:
<asp:Label ID="news_dateLabel" runat="server" Text='<%# Bind("news_date") %>' />
<br />
news_content:
<asp:Label ID="news_contentLabel" runat="server"
Text='<%# Bind("news_content") %>' />
<br />
news_order:
<asp:Label ID="news_orderLabel" runat="server"
Text='<%# Bind("news_order") %>' />
<br />
news_enable:
<asp:CheckBox ID="news_enableCheckBox" runat="server"
Checked='<%# Bind("news_enable") %>' Enabled="false" />
<br />
<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False"
CommandName="Edit" Text="编辑" />
<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False"
CommandName="Delete" Text="删除" />
<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False"
CommandName="New" Text="新建" />
</ItemTemplate>
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
</asp:FormView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/mdb/mydb.mdb"
DeleteCommand="DELETE FROM [t_news_mng] WHERE [news_id] = ?"
InsertCommand="INSERT INTO [t_news_mng] ([news_id], [news_ttl], [news_date], [news_content], [news_order], [news_enable]) VALUES (?, ?, ?, ?, ?, ?)"
SelectCommand="SELECT * FROM [t_news_mng]"
UpdateCommand="UPDATE [t_news_mng] SET [news_ttl] = ?, [news_date] = ?, [news_content] = ?, [news_order] = ?, [news_enable] = ? WHERE [news_id] = ?">
<DeleteParameters>
<asp:Parameter Name="news_id" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="news_id" Type="Int32" />
<asp:Parameter Name="news_ttl" Type="String" />
<asp:Parameter Name="news_date" Type="DateTime" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_order" Type="Int32" />
<asp:Parameter Name="news_enable" Type="Boolean" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="news_ttl" Type="String" />
<asp:Parameter Name="news_date" Type="DateTime" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_order" Type="Int32" />
<asp:Parameter Name="news_enable" Type="Boolean" />
<asp:Parameter Name="news_id" Type="Int32" />
</UpdateParameters>
</asp:AccessDataSource>
</asp:Content>
listview.aspx代码如下:
<%@ Page Title="" Language="C#" MasterPageFile="~/A_7_1_DataControlShow.master" AutoEventWireup="true" CodeFile="5_listviewshow.aspx.cs" Inherits="_5_listviewshow" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h2 class="h2ttl">5.ListView 演示</h2>
<asp:ListView ID="ListView1" runat="server" DataKeyNames="news_id"
DataSourceID="AccessDataSource1" InsertItemPosition="LastItem">
<AlternatingItemTemplate>
<tr style="background-color: #FAFAD2;color: #284775;">
<td>
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="删除" />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="编辑" />
</td>
<td>
<asp:Label ID="news_idLabel" runat="server" Text='<%# Eval("news_id") %>' />
</td>
<td>
<asp:Label ID="news_ttlLabel" runat="server" Text='<%# Eval("news_ttl") %>' />
</td>
<td>
<asp:Label ID="news_dateLabel" runat="server" Text='<%# Eval("news_date") %>' />
</td>
<td>
<asp:Label ID="news_contentLabel" runat="server"
Text='<%# Eval("news_content") %>' />
</td>
<td>
<asp:Label ID="news_orderLabel" runat="server"
Text='<%# Eval("news_order") %>' />
</td>
<td>
<asp:CheckBox ID="news_enableCheckBox" runat="server"
Checked='<%# Eval("news_enable") %>' Enabled="false" />
</td>
</tr>
</AlternatingItemTemplate>
<EditItemTemplate>
<tr style="background-color: #FFCC66;color: #000080;">
<td>
<asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="更新" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="取消" />
</td>
<td>
<asp:Label ID="news_idLabel1" runat="server" Text='<%# Eval("news_id") %>' />
</td>
<td>
<asp:TextBox ID="news_ttlTextBox" runat="server"
Text='<%# Bind("news_ttl") %>' />
</td>
<td>
<asp:TextBox ID="news_dateTextBox" runat="server"
Text='<%# Bind("news_date") %>' />
</td>
<td>
<asp:TextBox ID="news_contentTextBox" runat="server"
Text='<%# Bind("news_content") %>' />
</td>
<td>
<asp:TextBox ID="news_orderTextBox" runat="server"
Text='<%# Bind("news_order") %>' />
</td>
<td>
<asp:CheckBox ID="news_enableCheckBox" runat="server"
Checked='<%# Bind("news_enable") %>' />
</td>
</tr>
</EditItemTemplate>
<EmptyDataTemplate>
<table runat="server"
style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
<tr>
<td>
未返回数据。</td>
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<tr style="">
<td>
<asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="插入" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="清除" />
</td>
<td>
</td>
<td>
<asp:TextBox ID="news_ttlTextBox" runat="server"
Text='<%# Bind("news_ttl") %>' />
</td>
<td>
<asp:TextBox ID="news_dateTextBox" runat="server"
Text='<%# Bind("news_date") %>' />
</td>
<td>
<asp:TextBox ID="news_contentTextBox" runat="server"
Text='<%# Bind("news_content") %>' />
</td>
<td>
<asp:TextBox ID="news_orderTextBox" runat="server"
Text='<%# Bind("news_order") %>' />
</td>
<td>
<asp:CheckBox ID="news_enableCheckBox" runat="server"
Checked='<%# Bind("news_enable") %>' />
</td>
</tr>
</InsertItemTemplate>
<ItemTemplate>
<tr style="background-color: #FFFBD6;color: #333333;">
<td>
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="删除" />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="编辑" />
</td>
<td>
<asp:Label ID="news_idLabel" runat="server" Text='<%# Eval("news_id") %>' />
</td>
<td>
<asp:Label ID="news_ttlLabel" runat="server" Text='<%# Eval("news_ttl") %>' />
</td>
<td>
<asp:Label ID="news_dateLabel" runat="server" Text='<%# Eval("news_date") %>' />
</td>
<td>
<asp:Label ID="news_contentLabel" runat="server"
Text='<%# Eval("news_content") %>' />
</td>
<td>
<asp:Label ID="news_orderLabel" runat="server"
Text='<%# Eval("news_order") %>' />
</td>
<td>
<asp:CheckBox ID="news_enableCheckBox" runat="server"
Checked='<%# Eval("news_enable") %>' Enabled="false" />
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table ID="itemPlaceholderContainer" runat="server" border="1"
style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr runat="server" style="background-color: #FFFBD6;color: #333333;">
<th runat="server">
</th>
<th runat="server">
news_id</th>
<th runat="server">
news_ttl</th>
<th runat="server">
news_date</th>
<th runat="server">
news_content</th>
<th runat="server">
news_order</th>
<th runat="server">
news_enable</th>
</tr>
<tr ID="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server"
style="text-align: center;background-color: #FFCC66;font-family: Verdana, Arial, Helvetica, sans-serif;color: #333333;">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
<SelectedItemTemplate>
<tr style="background-color: #FFCC66;font-weight: bold;color: #000080;">
<td>
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="删除" />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="编辑" />
</td>
<td>
<asp:Label ID="news_idLabel" runat="server" Text='<%# Eval("news_id") %>' />
</td>
<td>
<asp:Label ID="news_ttlLabel" runat="server" Text='<%# Eval("news_ttl") %>' />
</td>
<td>
<asp:Label ID="news_dateLabel" runat="server" Text='<%# Eval("news_date") %>' />
</td>
<td>
<asp:Label ID="news_contentLabel" runat="server"
Text='<%# Eval("news_content") %>' />
</td>
<td>
<asp:Label ID="news_orderLabel" runat="server"
Text='<%# Eval("news_order") %>' />
</td>
<td>
<asp:CheckBox ID="news_enableCheckBox" runat="server"
Checked='<%# Eval("news_enable") %>' Enabled="false" />
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/mdb/mydb.mdb"
DeleteCommand="DELETE FROM [t_news_mng] WHERE [news_id] = ?"
InsertCommand="INSERT INTO [t_news_mng] ([news_ttl], [news_date], [news_content], [news_order], [news_enable]) VALUES (?, ?, ?, ?, ?)"
SelectCommand="SELECT * FROM [t_news_mng]"
UpdateCommand="UPDATE [t_news_mng] SET [news_ttl] = ?, [news_date] = ?, [news_content] = ?, [news_order] = ?, [news_enable] = ? WHERE [news_id] = ?">
<DeleteParameters>
<asp:Parameter Name="news_id" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="news_ttl" Type="String" />
<asp:Parameter Name="news_date" Type="DateTime" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_order" Type="Int32" />
<asp:Parameter Name="news_enable" Type="Boolean" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="news_ttl" Type="String" />
<asp:Parameter Name="news_date" Type="DateTime" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_order" Type="Int32" />
<asp:Parameter Name="news_enable" Type="Boolean" />
<asp:Parameter Name="news_id" Type="Int32" />
</UpdateParameters>
</asp:AccessDataSource>
</asp:Content>