是高手的就解决GridView自定分页问题(包含页码)
用 <PagerTemplate> </PagerTemplate> 进行自定义分页功能,
要求有:
第N页/共M页 首页 下一页 1 2 3 4 5 6 7 8 9 10 ... 上一页 未页 转到 X 页
不知哪个高手能解决这样的问题?
------解决方案--------------------来看高手 up
------解决方案--------------------在gridView自带的分页功能里
PagerSettings有四个mode
可惜的是都没有达到你要求的那种效果
这个你要自己写代码了
网上关于分页的蛮多的
找找看吧
------解决方案--------------------自定义分页
------解决方案--------------------做过datagrid的
可以参考一下
<%@ Page Language= "C# " AutoEventWireup= "true " CodeFile= "datagrid.aspx.cs " Inherits= "dataset_datagrid " %>
<!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:DataGrid ID= "DataGrid1 " OnDeleteCommand= "DataGrid1_DeleteCommand " OnUpdateCommand= "DataGrid1_UpdateCommand " OnCancelCommand= "DataGrid1_CancelCommand " OnEditCommand= "DataGrid1_EditCommand " runat= "server " AutoGenerateColumns= "False " CellPadding= "4 " BackColor= "White " BorderColor= "#3366CC " BorderWidth= "1px " Width= "747px " AllowPaging= "True " OnPageIndexChanged= "DataGrid1_PageIndexChanged " OnItemCreated= "DataGrid1_ItemCreated " PageSize= "5 " BorderStyle= "None " >
<Columns>
<asp:EditCommandColumn CancelText= "取消 " EditText= "编辑 " UpdateText= "更新 " HeaderText= "编辑 "> </asp:EditCommandColumn>
<asp:BoundColumn DataField= "用户名 " HeaderText= "用户名 " ReadOnly= "True "> </asp:BoundColumn>
<asp:BoundColumn DataField= "密码 " HeaderText= "密码 "> </asp:BoundColumn>
<asp:BoundColumn DataField= "昵称 " HeaderText= "昵称 "> </asp:BoundColumn>
<asp:BoundColumn DataField= "电子邮件 " HeaderText= "电子邮件 "> </asp:BoundColumn>
<asp:BoundColumn DataField= "专业 " HeaderText= "专业 "> </asp:BoundColumn>
<asp:ButtonColumn CommandName= "Delete " Text= "删除 " HeaderText= "删除 "> </asp:ButtonColumn>
<asp:HyperLinkColumn DataNavigateUrlField= "专业 " DataNavigateUrlFormatString= "http://localhost/1.asp?proid={0} "
DataTextField= "专业 " HeaderText= "连接 " Target= "_blank "> </asp:HyperLinkColumn>
</Columns>
<FooterStyle BackColor= "#99CCCC " ForeColor= "#003399 " />
<SelectedItemStyle BackColor= "#009999 " ForeColor= "#CCFF99 " Font-Bold= "True " />
<PagerStyle BackColor= "#99CCCC " ForeColor= "#003399 " HorizontalAlign= "Center " Mode= "NumericPages " />