效果如图:
Code
1 protected void UltraWebGrid1_PageIndexChanged(object sender, Infragistics.WebUI.UltraWebGrid.PageEventArgs e)
2 {
3 Bind(e.NewPageIndex);
4 this.UltraWebGrid1.DisplayLayout.Pager.CurrentPageIndex = e.NewPageIndex;
5 }
6
7 protected void Bind(int pageNumber)
8 {
9 int total = 0;
10 int pageSize = 15;
11
12 this.UltraWebGrid1.DataSource = new BsSoft.DAL.SA00().GetItem(out total, pageSize, pageNumber);
13 this.UltraWebGrid1.DataBind();
14 this.UltraWebGrid1.DisplayLayout.Pager.PageCount = GetCountPage(total, pageSize);
15 }
16
17 private int GetCountPage(int total, int pageSize)
18 {
19 if (total % pageSize == 0)
20 {
21 return total / pageSize;
22 }
23 else
24 {
25 return (total / pageSize) + 1;
26 }
27 }
1 protected void UltraWebGrid1_PageIndexChanged(object sender, Infragistics.WebUI.UltraWebGrid.PageEventArgs e)
2 {
3 Bind(e.NewPageIndex);
4 this.UltraWebGrid1.DisplayLayout.Pager.CurrentPageIndex = e.NewPageIndex;
5 }
6
7 protected void Bind(int pageNumber)
8 {
9 int total = 0;
10 int pageSize = 15;
11
12 this.UltraWebGrid1.DataSource = new BsSoft.DAL.SA00().GetItem(out total, pageSize, pageNumber);
13 this.UltraWebGrid1.DataBind();
14 this.UltraWebGrid1.DisplayLayout.Pager.PageCount = GetCountPage(total, pageSize);
15 }
16
17 private int GetCountPage(int total, int pageSize)
18 {
19 if (total % pageSize == 0)
20 {
21 return total / pageSize;
22 }
23 else
24 {
25 return (total / pageSize) + 1;
26 }
27 }
.aspx页:
Code
<script type="text/javascript">
function goPage(event)
{
igtbl_pageGrid(event,'UltraWebGrid1',$("PageNum").value);
}
</script>
<script type="text/javascript">
function goPage(event)
{
igtbl_pageGrid(event,'UltraWebGrid1',$("PageNum").value);
}
</script>
UltrGrid 的pager的设置为:
Code
<pager allowcustompaging="True" allowpaging="True" changelinkscolor="True"
minimumpagesfordisplay="2" pagesize="20" quickpages="6" stylemode="QuickPages"
pattern="页码:[currentpageindex]/[pagecount] 每页:[pagesize] [page:1:first] [prev] [default] [next] [page:[pagecount]:last] <input id=PageNum size=2 type=text /><input id=btgo type=button value=go onclick=javascript:goPage(event) />">
<PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px"
Height="25px">
<borderdetails colorleft="White" colortop="White" widthleft="1px"
widthtop="1px" />
</PagerStyle>
</pager>
<pager allowcustompaging="True" allowpaging="True" changelinkscolor="True"
minimumpagesfordisplay="2" pagesize="20" quickpages="6" stylemode="QuickPages"
pattern="页码:[currentpageindex]/[pagecount] 每页:[pagesize] [page:1:first] [prev] [default] [next] [page:[pagecount]:last] <input id=PageNum size=2 type=text /><input id=btgo type=button value=go onclick=javascript:goPage(event) />">
<PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px"
Height="25px">
<borderdetails colorleft="White" colortop="White" widthleft="1px"
widthtop="1px" />
</PagerStyle>
</pager>