ListView DataPager asp.net 太強大

來源:互聯網
上載者:User

 

代碼


<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>
&nbsp;
</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>

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.