欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【如何实现ListView高效分页代码】,下面是详细的讲解!
如何实现ListView高效分页代码
View Code
<% @ Page Language="C#" AutoEventWireup="true" CodeBehind="ListView.aspx.cs" Inherits="WebForm.ListView" %>
<! 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>
</ head>
< body>
<form id="form1" runat="server">
<div >
< asp: ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="getPageListByPage" TypeName="BLL.Classes"
DataObjectTypeName="MODEL.Classes" DeleteMethod="SoftDel" InsertMethod="Add"
UpdateMethod="Modify" EnablePaging="True"
MaximumRowsParameterName="rowIndex" SelectCountMethod="GetTotalRowsCount"
StartRowIndexParameterName="pageSize">
</ asp: ObjectDataSource >
< asp: ListView ID="ListView1" runat="server" DataSourceID="ObjectDataSource1"
InsertItemPosition="LastItem">
< AlternatingItemTemplate>
< tr style="">
< td>
< asp: Button ID="DeleteButton" runat="server" CommandName="Delete" Text="删除" />
< asp: Button ID="EditButton" runat="server" CommandName="Edit" Text="编辑" />
</ td>
< td>
< asp: Label ID="CIDLabel" runat="server" Text=' <%# Eval("CID") %> ' />
</ td>
< td>
< asp: Label ID="CNameLabel" runat="server" Text=' <%# Eval("CName") %> ' />
</ td>
< td>
< asp: Label ID="CCountLabel" runat="server" Text=' <%# Eval("CCount") %> ' />
</ td>
< td>
< asp: Label ID="CImgLabel" runat="server" Text=' <%# Eval("CImg") %> ' />
</ td>
< td>
< asp: CheckBox ID="CIsDelCheckBox" runat="server"
Checked='<% # Eval("CIsDel") %> ' Enabled="false" />
</ td>
< td>
< asp: Label ID="CAddTimeLabel" runat="server" Text=' <%# Eval("CAddTime") %> ' />
</ td>
</ tr>
</ AlternatingItemTemplate>
< EditItemTemplate>
< tr style="">
< td>
< asp: Button ID="UpdateButton" runat="server" CommandName="Update" Text="更新" />
< asp: Button ID="CancelButton" runat="server" CommandName="Cancel" Text="取消" />
</ td>
< td>
< asp: TextBox ID="CIDTextBox" runat="server" Text=' <%# Bind("CID") %> ' />
</ td>
< td>
< asp: TextBox ID="CNameTextBox" runat="server" Text=' <%# Bind("CName") %> ' />
</ td>
< td>
< asp: TextBox ID="CCountTextBox" runat="server" Text=' <%# Bind("CCount") %> ' />
</ td>
< td>
< asp: TextBox ID="CImgTextBox" runat="server" Text=' <%# Bind("CImg") %> ' />
</ td>
< td>
< asp: CheckBox ID="CIsDelCheckBox" runat="server"
Checked='<% # Bind("CIsDel") %> ' />
</ td>
< td>
< asp: TextBox ID="CAddTimeTextBox" runat="server"
Text='<% # Bind("CAddTime") %> ' />
</ td>
</ tr>
</ EditItemTemplate>
< EmptyDataTemplate>
< table runat="server"
style="">
< 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>
< asp: TextBox ID="CIDTextBox" runat="server" Text=' <%# Bind("CID") %> ' />
</ td>
< td>
< asp: TextBox ID="CNameTextBox" runat="server" Text=' <%# Bind("CName") %> ' />
</ td>
< td>
< asp: TextBox ID="CCountTextBox" runat="server" Text=' <%# Bind("CCount") %> ' />
</ td>
< td>
< asp: TextBox ID="CImgTextBox" runat="server" Text=' <%# Bind("CImg") %> ' />
</ td>
< td>
< asp: CheckBox ID="CIsDelCheckBox" runat="server"
Checked='<% # Bind("CIsDel") %> ' />
</ td>
< td>
< asp: TextBox ID="CAddTimeTextBox" runat="server"
Text='<% # Bind("CAddTime") %> ' />
</ td>
</ tr>
</ InsertItemTemplate>
< ItemTemplate>
< tr style="">
< td>
< asp: Button ID="DeleteButton" runat="server" CommandName="Delete" Text="删除" />
< asp: Button ID="EditButton" runat="server" CommandName="Edit" Text="编辑" />
</ td>
< td>
< asp: Label ID="CIDLabel" runat="server" Text=' <%# Eval("CID") %> ' />
</ td>
< td>
< asp: Label ID="CNameLabel" runat="server" Text=' <%# Eval("CName") %> ' />
</ td>
< td>
< asp: Label ID="CCountLabel" runat="server" Text=' <%# Eval("CCount") %> ' />
</ td>
< td>
< asp: Label ID="CImgLabel" runat="server" Text=' <%# Eval("CImg") %> ' />
</ td>
< td>
< asp: CheckBox ID="CIsDelCheckBox" runat="server"
Checked='<% # Eval("CIsDel") %> ' Enabled="false" />
</ td>
< td>
< asp: Label ID="CAddTimeLabel" runat="server" Text=' <%# Eval("CAddTime") %> ' />
</ td>
</ tr>
</ ItemTemplate>
< LayoutTemplate>
< table runat="server">
< tr runat="server">
< td runat="server">
< table ID="itemPlaceholderContainer" runat="server" border="0"
style="">
< tr runat="server" style="">
< th runat="server">
</ th>
< th runat="server">
CID </ th>
< th runat="server">
CName </ th>
< th runat="server">
CCount </ th>
< th runat="server">
CImg </ th>
< th runat="server">
CIsDel </ th>
< th runat="server">
CAddTime </ th>
</ tr>
< tr ID="itemPlaceholder" runat="server">
</ tr>
</ table>
</ td>
</ tr>
< tr runat="server">
< td runat="server"
style="">
</ td>
</ tr>
</ table>
</ LayoutTemplate>
< SelectedItemTemplate>
< tr style="">
< td>
< asp: Button ID="DeleteButton" runat="server" CommandName="Delete" Text="删除" />
< asp: Button ID="EditButton" runat="server" CommandName="Edit" Text="编辑" />
</ td>
< td>
< asp: Label ID="CIDLabel" runat="server" Text=' <%# Eval("CID") %> ' />
</ td>
< td>
< asp: Label ID="CNameLabel" runat="server" Text=' <%# Eval("CName") %> ' />
</ td>
< td>
< asp: Label ID="CCountLabel" runat="server" Text=' <%# Eval("CCount") %> ' />
</ td>
< td>
< asp: Label ID="CImgLabel" runat="server" Text=' <%# Eval("CImg") %> ' />
</ td>
< td>
< asp: CheckBox ID="CIsDelCheckBox" runat="server"
Checked='<% # Eval("CIsDel") %> ' Enabled="false" />
</ td>
< td>
< asp: Label ID="CAddTimeLabel" runat="server" Text=' <%# Eval("CAddTime") %> ' />
</ td>
</ tr>
</ SelectedItemTemplate>
</ asp: ListView >
</div >
<asp : DataPager ID="DataPager1" runat="server" PagedControlID="ListView1"
PageSize="5">
< Fields>
< asp: NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowLastPageButton="True" />
</ Fields>
</asp : DataPager>
</form >
</ body>
</ html>
关于如何实现ListView高效分页代码的用户互动如下:
相关问题:
答: >>详细
相关问题:
答: >>详细
相关问题:
答: >>详细
- 【asp】asp.net url重写浅谈-net-url重写
- 【DataSet】DataSet、DataTable、DataRow区别详解
- 【asp】asp.net 动态添加多个用户控件-net-动态添
- 【ASP】ASP.NET中内嵌页面代码的一个问题-NET-内
- 【As】Asp.net中的页面乱码的问题-sp--pn-ne-et
- 【增加记录】asp.net中获取新增加记录的ID Access
- 【创建】ASP.NET Web API教程 创建域模型的方法详
- 【Asp】Asp.net 页面调用javascript变量的值-net-
- 【ASP】ASP.NET 5升级后如何删除旧版本的DNX-NET5
- 【404页面】ASP.NET设置404页面返回302HTTP状态码
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
