By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,246 Members | 1,451 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,246 IT Pros & Developers. It's quick & easy.

Complex Challenge Custom Paging of a DataGrid

P: n/a
This is a real brain-teaser and i'd really appreciate it if someone can try
and understand what im trying to do and give me a few pointers or ideas to
help me work out my problem.
Im basically using the example of CUSTOM PAGING on a DataGrid on this page:
and im trying to add extra functionality in the DataGrid Paging - Custom
Paging example. I'm able to get the navigation working which does the

First < > Last

But now I want to add extra funtionality which allows me to navigate doing
something like this

First << < |1|2|3|4|5| > >> Last
when the >> is clicked I want this to happen. when each button is clicked
I'd like the datagrid to go to the correct page.
First << < |6|7|8|9|10| > >> Last

Here is the part of the code which I think my code needs to be added to
achieve this. Can someone please help me. Please refer to the example on the
web page to understand what im trying to do.

protected void NavigationLink_Click ( Object sender, CommandEventArgs e )
switch ( e.CommandName )
case "First":
_currentPageNumber = 1;

case "Last":
_currentPageNumber = Int32.Parse ( TotalPages.Text );

case "Next":
_currentPageNumber = Int32.Parse ( CurrentPage.Text ) + 1;

case "Prev":
_currentPageNumber = Int32.Parse ( CurrentPage.Text ) - 1;
case "Next5":
/* Need code in here to allow the Page navigation to do something fairly
complex. I want my pages to go like this
|1|2|3|4|5| to |6|7|8|9|10| when I click the Command Next5.
You see this all the time in hotmail, this weeksite etc. Basically I'm using
custom paging navigation to navigate through my datagrid, but i've never done
anything like this before and im finding it tough. I used the example on
but now I want to add extra functionality by adding numbers of pages. In
this Case statement I want to be able to add extra cases which allow me to go
to the correct pages. My Navigation bar looks like this:
First << < |1|2|3|4|5| > >> Last.
//_currentPageNumber = Int32.Parse ( CurrentPage.Text ) + 5;

The databind method along with the other code is on the website. Its an
excellent link, its just I need to go a step further.
Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.