Pagination | control | Problems before the time to do ASP is not short, but do asp.net I am a novice. A few days ago to do the project, encountered a problem, requiring more complex data format display, with a DataGrid is very difficult to achieve, and later used the Repeater control to achieve. But this brings up a new problem: How to page pagination? Repeater does not have a built-in paging capability. Later, I tried to write one, I was lucky to succeed. Hastily written on, certainly imperfect, which Master has any ideas please correct, very willing to communicate with you (zhoubin@mail.sdu.edu.cn)
Current cursor index of the Rptframework control (1 start)
int intcurrentitemindex = 1;
Intcurrentitemindex = Intpagesize * (intCurrentPageIndex-1) + 1;
Next Page button mask
if ((Rptframework.items.count-intcurrentitemindex) < intpagesize)
{
btnnext.enabled = false;
}
Set the default view when a form is loaded
if (RptFramework.Items.Count > Intpagesize)
{
for (i = Intcurrentitemindex i < getmin (RptFramework.Items.Count, Intcurrentitemindex + intpagesize); i++)
{
RPTFRAMEWORK.ITEMS[I-1]. Visible = true;
}
}
}
Take the smaller value of two values, but do not change the original value size
private int Getmin (int a, int b)
{
int C;
if (a > B)
{
c = b;
}
Else
{
c = A;
}
return C;
}
Click on the previous page button
private void Btnpre_click (object sender, System.EventArgs e)
{
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.