By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,889 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,889 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:
http://www.dotnetjunkies.com/Tutoria...B871F967F.dcik
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
following

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;
break;

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

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

case "Prev":
_currentPageNumber = Int32.Parse ( CurrentPage.Text ) - 1;
break;
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
http://www.dotnetjunkies.com/Tutoria...B871F967F.dcik
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;
//break;
}
BindData();
}

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.
Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.