ListView DataPager asp.net 太强大
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
<LayoutTemplate>
<table border="1">
<thead>
<tr>
<th>
SvrNum
</th>
<th>
Marks
</th>
<th>
Release Date
</th>
</tr>
</thead>
<tbody>
<asp:PlaceHolder runat="server" ID="itemPlaceholder" />
</tbody>
</table>
<div>
<asp:DataPager ID="DataPager1" runat="server" PageSize="1" QueryStringField="page" >
<Fields>
<asp:NumericPagerField />
</Fields>
</asp:DataPager>
</div>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<%# Eval("SvrNum")%>
</td>
<td>
<%# Eval("Marks")%>
</td>
<td>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:testConnectionString %>"
DeleteCommand="DELETE FROM [Log_Member_Marks] WHERE [ID] = @original_ID AND [SvrNum] = @original_SvrNum AND [Marks] = @original_Marks"
InsertCommand="INSERT INTO [Log_Member_Marks] ([SvrNum], [Marks]) VALUES (@SvrNum, @Marks)"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT * FROM [Log_Member_Marks]"
UpdateCommand="UPDATE [Log_Member_Marks] SET [SvrNum] = @SvrNum, [Marks] = @Marks WHERE [ID] = @original_ID AND [SvrNum] = @original_SvrNum AND [Marks] = @original_Marks">
<DeleteParameters>
<asp:Parameter Name="original_ID" Type="Int64" />
<asp:Parameter Name="original_SvrNum" Type="Int64" />
<asp:Parameter Name="original_Marks" Type="Double" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="SvrNum" Type="Int64" />
<asp:Parameter Name="Marks" Type="Double" />
<asp:Parameter Name="original_ID" Type="Int64" />
<asp:Parameter Name="original_SvrNum" Type="Int64" />
<asp:Parameter Name="original_Marks" Type="Double" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="SvrNum" Type="Int64" />
<asp:Parameter Name="Marks" Type="Double" />
</InsertParameters>
</asp:SqlDataSource>
<asp:ListView ID="_groupListView" runat="server"
DataKeyNames="movie_id" DataSourceID="_moviesDataSource"
GroupItemCount="4" >
<GroupTemplate>
<tr>
<asp:PlaceHolder runat="server" ID="itemPlaceholder" />
</tr>
</GroupTemplate>
<LayoutTemplate>
<table>
<asp:PlaceHolder ID="groupPlaceholder" runat="server" />
</table>
</LayoutTemplate>
<ItemTemplate>
<td>
movie_id:
<asp:Label ID="_movie_idLabel" runat="server"
Text='<%# Eval("movie_id") %>' /> <br />
title:
<asp:Label ID="_titleLabel" runat="server"
Text='<%# Eval("title") %>' /> <br />
release_date:
<asp:Label ID="_release_dateLabel" runat="server"
Text='<%# Eval("release_date", "{0:d}") %>' /> <br />
<br />
</td>
</ItemTemplate>
</asp:ListView>