Pagination Infragistics UltraWebGrid自定义分页
我在应用程序中使用Infragistics UltraWebGrid,当我使用自定义分页时,我无法检索每页指定数量的记录 我写的代码是 字符串标签 在网格中初始化Pagination Infragistics UltraWebGrid自定义分页,pagination,infragistics,ultrawebgrid,Pagination,Infragistics,Ultrawebgrid,我在应用程序中使用Infragistics UltraWebGrid,当我使用自定义分页时,我无法检索每页指定数量的记录 我写的代码是 字符串标签 在网格中初始化 grid.DisplayLayout.Pager.AllowCustomPaging = true; grid.DisplayLayout.Pager.AllowPaging = true; grid.DisplayLayout.Pager.StyleMode = PagerStyleMode.CustomLabels
grid.DisplayLayout.Pager.AllowCustomPaging = true;
grid.DisplayLayout.Pager.AllowPaging = true;
grid.DisplayLayout.Pager.StyleMode = PagerStyleMode.CustomLabels;
grdSysManager.DisplayLayout.Pager.PageSize = 3;
getCustomLabel();
grdSysManager.DisplayLayout.Pager.CustomLabels = cusLabel;
private void getCustomLabel()
{
DataTable dt = (DataTable)grdSysManager.DataSource;
DataSet ds = new DataSet();
ds = dt.DataSet;
//ds = (DataSet)grdSysManager.DataSource;
int NoOfRows = ds.Tables[0].Rows.Count;
int PageSize = grdSysManager.DisplayLayout.Pager.PageSize;
if (NoOfRows % PageSize == 0)
{
totalNoOfPagings = NoOfRows / PageSize;
}
else
{
totalNoOfPagings = (NoOfRows / PageSize) + 1;
}
cusLabel = new string[totalNoOfPagings + 2];
cusLabel[0] = "First";
for (int i = 1; i <= totalNoOfPagings; i++)
{
cusLabel[i] = i.ToString();
}
cusLabel[totalNoOfPagings + 1] = "Last";
}
grid.DisplayLayout.Pager.AllowCustomCompaging=true;
grid.DisplayLayout.Pager.AllowPaging=true;
grid.DisplayLayout.Pager.StyleMode=PagerStyleMode.CustomLabels;
grdSysManager.DisplayLayout.Pager.PageSize=3;
getCustomLabel();
grdSysManager.DisplayLayout.Pager.CustomLabels=cusLabel;
私有void getCustomLabel()
{
DataTable dt=(DataTable)grdSysManager.DataSource;
数据集ds=新数据集();
ds=dt.DataSet;
//ds=(数据集)grdSysManager.DataSource;
int NoOfRows=ds.Tables[0].Rows.Count;
int PageSize=grdSysManager.DisplayLayout.Pager.PageSize;
if(NoOfRows%PageSize==0)
{
TotalNoofPagins=NoOfRows/PageSize;
}
其他的
{
totalNoOfPagings=(NoOfRows/PageSize)+1;
}
cusLabel=新字符串[totalNoOfPagings+2];
cusLabel[0]=“第一”;
对于(int i=1;i我认为PageSize
是在使用自定义分页时自定义标签的数量。为了使网格每页只有三行,必须在网格的数据绑定事件中只给它三行
使用此网格的自定义分页不仅仅是关于分页器的自定义外观,而是关于您自己控制大部分分页过程。网格将显示您的自定义标签,并将它们全部转换为超链接(指示为当前页面的链接除外)。当您单击其中一个链接时,PageIndexChanged将显示它将告诉您所单击链接的索引。如何使用该索引取决于您自己
<table cellspacing='0' cellpadding='0' width='100%'>
<tr>
<td width='12%' align='left'>
[currentpageindex]/[pagecount]
</td>
<td width='76%'>
<b>[page:1:First] [prev]</b>
[default]
<b>[next] [page:[pagecount]:Last]</b>
</td>
<td width='12%' align='right' title='Enter page number and press Enter'>
Go to:
<input id='xtxtGotoPage' size='5'
style='font-family:verdana;font-size:8pt;padding:0 0 0 0'
type='text' onKeyPress='return gotoPage()' autocomplete='off' />
</td>
</tr>
</table>
function gotoPage() {
if (event.keyCode == 13) {
var otxtGotoPage = event.srcElement;
var iPageNo = otxtGotoPage.value
if (!isNaN(iPageNo)) {
var oGrid = igtbl_getGridById('xuwgMyGrid');
if (iPageNo < 1 || iPageNo > oGrid.PageCount) {
alert('Please enter page number between 1 and ' +
oGrid.PageCount)
} else {
oGrid.goToPage(iPageNo)
}
} else {
alert('Please enter correct numeric page number');
}
otxtGotoPage.focus();
otxtGotoPage.value = '';
return false;
}
}