1.数据绑定
语法:<%# Eval("PhotoID") %>
2.自定义分页
<asp:ImageButton ID="ImageButton9" Runat="server" CommandName="Page" CommandArgument="First" skinid="first"/>
<asp:ImageButton ID="ImageButton10" Runat="server" CommandName="Page" CommandArgument="Prev" skinid="prev"/>
<asp:ImageButton ID="ImageButton11" Runat="server" CommandName="Page" CommandArgument="Next" skinid="next"/>
<asp:ImageButton ID="ImageButton12" Runat="server" CommandName="Page" CommandArgument="Last" skinid="last"/>
<asp:ImageButton ID="ImageButton10" Runat="server" CommandName="Page" CommandArgument="Prev" skinid="prev"/>
<asp:ImageButton ID="ImageButton11" Runat="server" CommandName="Page" CommandArgument="Next" skinid="next"/>
<asp:ImageButton ID="ImageButton12" Runat="server" CommandName="Page" CommandArgument="Last" skinid="last"/>
3.事件绑定:
<asp:ObjectDataSource ID="ObjectDataSource1" Runat="server" TypeName="PhotoManager"
SelectMethod="GetPhotos"
InsertMethod="AddPhoto"
DeleteMethod="RemovePhoto"
UpdateMethod="EditPhoto" >
<SelectParameters>
<asp:QueryStringParameter Name="AlbumID" Type="Int32" QueryStringField="AlbumID" />
</SelectParameters>
<InsertParameters>
<asp:QueryStringParameter Name="AlbumID" Type="Int32" QueryStringField="AlbumID" />
</InsertParameters>
</asp:ObjectDataSource>
绑定数据源即可。里面的Method对应业务层对象的方法。
设计步骤如下: