zoukankan
html css js c++ java
.3.5 DataPager 分页
跳转到第几页
public
void
TemplatePagerField_OnPagerCommand(
object
sender, DataPagerCommandEventArgs e)
{
switch
(e.CommandName)
{
case
"
abc
"
:
TextBox index
=
(TextBox)(e.Item.FindControl(
"
All
"
));
e.NewStartRowIndex
=
e.Item.Pager.PageSize
*
(
int
.Parse (index.Text)
-
1
);
e.NewMaximumRows
=
e.Item.Pager.MaximumRows;
break
;
}
}
<
asp:ListView
ID
="ListView1"
runat
="server"
DataKeyNames
="CustomerID"
DataSourceID
="SqlDataSource1"
>
<
AlternatingItemTemplate
>
<
tr
style
="background-color: #FAFAD2;color: #284775;"
>
<
td
>
<
asp:Label
ID
="CustomerIDLabel"
runat
="server"
Text
='<%#
Eval("CustomerID") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="CompanyNameLabel"
runat
="server"
Text
='<%#
Eval("CompanyName") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="ContactNameLabel"
runat
="server"
Text
='<%#
Eval("ContactName") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="ContactTitleLabel"
runat
="server"
Text
='<%#
Eval("ContactTitle") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="AddressLabel"
runat
="server"
Text
='<%#
Eval("Address") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="CityLabel"
runat
="server"
Text
='<%#
Eval("City") %
>
' />
</
td
>
</
tr
>
</
AlternatingItemTemplate
>
<
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-1px;font-family: Verdana, Arial, Helvetica, sans-serif;"
>
<
tr
runat
="server"
style
="background-color: #FFFBD6;color: #333333;"
>
<
th
runat
="server"
>
CustomerID
</
th
>
<
th
runat
="server"
>
CompanyName
</
th
>
<
th
runat
="server"
>
ContactName
</
th
>
<
th
runat
="server"
>
ContactTitle
</
th
>
<
th
runat
="server"
>
Address
</
th
>
<
th
runat
="server"
>
City
</
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;"
>
</
td
>
</
tr
>
</
table
>
</
LayoutTemplate
>
<
InsertItemTemplate
>
<
tr
style
=""
>
<
td
>
<
asp:Button
ID
="InsertButton"
runat
="server"
CommandName
="Insert"
Text
="Insert"
/>
<
asp:Button
ID
="CancelButton"
runat
="server"
CommandName
="Cancel"
Text
="Clear"
/>
</
td
>
<
td
>
<
asp:TextBox
ID
="CustomerIDTextBox"
runat
="server"
Text
='<%#
Bind("CustomerID") %
>
' />
</
td
>
<
td
>
<
asp:TextBox
ID
="CompanyNameTextBox"
runat
="server"
Text
='<%#
Bind("CompanyName") %
>
' />
</
td
>
<
td
>
<
asp:TextBox
ID
="ContactNameTextBox"
runat
="server"
Text
='<%#
Bind("ContactName") %
>
' />
</
td
>
<
td
>
<
asp:TextBox
ID
="ContactTitleTextBox"
runat
="server"
Text
='<%#
Bind("ContactTitle") %
>
' />
</
td
>
<
td
>
<
asp:TextBox
ID
="AddressTextBox"
runat
="server"
Text
='<%#
Bind("Address") %
>
' />
</
td
>
<
td
>
<
asp:TextBox
ID
="CityTextBox"
runat
="server"
Text
='<%#
Bind("City") %
>
' />
</
td
>
</
tr
>
</
InsertItemTemplate
>
<
SelectedItemTemplate
>
<
tr
style
="background-color: #FFCC66;font-weight: bold;color: #000080;"
>
<
td
>
<
asp:Label
ID
="CustomerIDLabel"
runat
="server"
Text
='<%#
Eval("CustomerID") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="CompanyNameLabel"
runat
="server"
Text
='<%#
Eval("CompanyName") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="ContactNameLabel"
runat
="server"
Text
='<%#
Eval("ContactName") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="ContactTitleLabel"
runat
="server"
Text
='<%#
Eval("ContactTitle") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="AddressLabel"
runat
="server"
Text
='<%#
Eval("Address") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="CityLabel"
runat
="server"
Text
='<%#
Eval("City") %
>
' />
</
td
>
</
tr
>
</
SelectedItemTemplate
>
<
EmptyDataTemplate
>
<
table
runat
="server"
style
="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-1px;"
>
<
tr
>
<
td
>
No data was returned.
</
td
>
</
tr
>
</
table
>
</
EmptyDataTemplate
>
<
EditItemTemplate
>
<
tr
style
="background-color: #FFCC66;color: #000080;"
>
<
td
>
<
asp:Button
ID
="UpdateButton"
runat
="server"
CommandName
="Update"
Text
="Update"
/>
<
asp:Button
ID
="CancelButton"
runat
="server"
CommandName
="Cancel"
Text
="Cancel"
/>
</
td
>
<
td
>
<
asp:Label
ID
="CustomerIDLabel1"
runat
="server"
Text
='<%#
Eval("CustomerID") %
>
' />
</
td
>
<
td
>
<
asp:TextBox
ID
="CompanyNameTextBox"
runat
="server"
Text
='<%#
Bind("CompanyName") %
>
' />
</
td
>
<
td
>
<
asp:TextBox
ID
="ContactNameTextBox"
runat
="server"
Text
='<%#
Bind("ContactName") %
>
' />
</
td
>
<
td
>
<
asp:TextBox
ID
="ContactTitleTextBox"
runat
="server"
Text
='<%#
Bind("ContactTitle") %
>
' />
</
td
>
<
td
>
<
asp:TextBox
ID
="AddressTextBox"
runat
="server"
Text
='<%#
Bind("Address") %
>
' />
</
td
>
<
td
>
<
asp:TextBox
ID
="CityTextBox"
runat
="server"
Text
='<%#
Bind("City") %
>
' />
</
td
>
</
tr
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
tr
style
="background-color: #FFFBD6;color: #333333;"
>
<
td
>
<
asp:Label
ID
="CustomerIDLabel"
runat
="server"
Text
='<%#
Eval("CustomerID") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="CompanyNameLabel"
runat
="server"
Text
='<%#
Eval("CompanyName") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="ContactNameLabel"
runat
="server"
Text
='<%#
Eval("ContactName") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="ContactTitleLabel"
runat
="server"
Text
='<%#
Eval("ContactTitle") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="AddressLabel"
runat
="server"
Text
='<%#
Eval("Address") %
>
' />
</
td
>
<
td
>
<
asp:Label
ID
="CityLabel"
runat
="server"
Text
='<%#
Eval("City") %
>
' />
</
td
>
</
tr
>
</
ItemTemplate
>
</
asp:ListView
>
<
asp:SqlDataSource
ID
="SqlDataSource1"
runat
="server"
ConnectionString
="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand
=" select Customers.CustomerID, Customers.CompanyName, Customers.ContactName,
Customers.ContactTitle,
Customers.Address, Customers.City FROM Customers,
Customers a
ORDER BY a.CustomerID"
>
</
asp:SqlDataSource
>
</
div
>
<
asp:DataPager
runat
="server"
ID
="AfterListDataPager"
PagedControlID
="ListView1"
PageSize
="18"
>
<
Fields
>
<
asp:NextPreviousPagerField
ButtonType
="Button"
ShowFirstPageButton
="True"
ShowNextPageButton
="False"
ShowPreviousPageButton
="False"
/>
<
asp:NumericPagerField
/>
<
asp:NextPreviousPagerField
ButtonType
="Button"
ShowLastPageButton
="True"
ShowNextPageButton
="False"
ShowPreviousPageButton
="False"
/>
<
asp:TemplatePagerField
OnPagerCommand
="TemplatePagerField_OnPagerCommand"
>
<
PagerTemplate
>
<
asp:TextBox
ID
="All"
runat
="server"
></
asp:TextBox
>
<
asp:Button
ID
="OK"
runat
="server"
Text
="abc"
CommandName
="abc"
/>
</
PagerTemplate
>
</
asp:TemplatePagerField
>
</
Fields
>
</
asp:DataPager
>
要是数据量大时,感效率不高
查看全文
相关阅读:
jQuery插件之jquery editable plugin点击编辑文字插件
firefox与ie的javascript兼容性编程汇编【转载】
css前端制作 经验总结
非常棒的jqChart图表插件
WPF Image Source设置文件路径后 在编辑状态下显示图片,运行时不显示
WPF RadioButton 绑定枚举
WPF MVVM实现数据增删改查逻辑全流程详细解析demo
bigNumber.js的简单使用
PHP程序的“Missing argument 3”的错误提示解决方法
PHP判断0和空的方法
原文地址:https://www.cnblogs.com/gwazy/p/1004100.html
最新文章
看上去很简单
tomcat启用https
端正态度好好改
JavaScript那些事儿(2):Math,Infinity与NaN,它们不是浮云,中学数学都学过
Html5 JumpStart学习笔记4:JavaScript Core Capabilities
Html5 JumpStart学习笔记2:CSS Selectors and Style Properties
Html5 JumpStart学习笔记5:Dom Interactions
Html5 JumpStart学习笔记3:Advanced Layout and Animation
JavaScript那些事儿(1):对比JavaScript和jQuery的Dom操作
[转]Event Model
热门文章
[转]VS2010 旗舰版显示代码覆盖率
开始 OpenGL
编译 QGIS 1.7.0
生成WORD的替代方案:生成RTF
[转]关于Tarjan算法的一段描述
object对象的hasOwnProperty propertyIsEnumerable两个方法的使用
动态的录入信息
关于 IE firefox Chrome下的通过用js 关闭窗口的一些问题
php中GD库的一些简单使用
jquery实现提示框的效果
Copyright © 2011-2022 走看看