Thursday, February 3, 2011

Custom Paging API

Normally in Win Application you have Paging option is available only for moving to Next or Previous record, and move to First or Last Record. Suppose if you want to set page wise navigation then you have to go for custom paging.

In codeplex you can find CustomPaging API this is an alpha release, they provide an set of inbuild methods for Record Navigation, and page navigation. You can make use this CustomPaging API to any Application both Windows or Web Application. You can download this CustomPaging API form here [Click Here To Download]

Class Description

Available Function in dsPaging

Properties

1) NumberOfRecordPerPage

Note:- This NumberOfRecordPerPage must be specify before you call any static method from below for paging at first time. This property hold how many number of records can disply per page.

Static Methods

1) List nextRow(int curentgridindex, int currentpage, int totalrowcount)

2) List previuosRow(int curentgridindex, int currentpage, int totalrowcount)

3) List nextPage(int curentgridindex, int currentpage, int totalrowcount)

4) List previousPage(int currentpage, int totalrowcount)

5) List LastRecord(int totalrowcount)

6) List FirstRecord()

7 ) List RefreshRow(int curentgridindex, int currentpage, int totalrowcount)

8 ) List GetPagePosition(int rowindex, int totalNumberofRow)

Note:-

Here curentgridindex:- Refer Current Select index of the grid

currentpage:- Current Page that is displayed on the grid

totalrowcount:- Total number of record that holds (Full row count and not per page row count)

rowindex:- Same as Currentgridindex.

Sample Code:

//Move to Next Row
private void NextRow_Click(object sender, EventArgs e)
{
int totalrowcount = ds.Tables[0].Rows.Count;
dsPaging.NumberOfRecordPerPage = Convert.ToInt32(textBox1.Text);
List poition = dsPaging.nextRow(currentindex, currentpage, totalrowcount);
currentindex = poition[0];
currentpage = poition[1];
Noofrow = poition[2];
ReFillGrid();
}

Any bug or Paging API question are always welcome.

No comments:

Post a Comment