Moving to the correct CurrentPageIndex in the datagrid.

J

Jim Mitchell

I have a datagrid of names 1000 names. I need a buttton to move to correct
currentpageindex for John Smith. The datagrid is sorted by name.

It seems so simple, but I can not seem to find a method to "Seek" the
contents of a datagrid that has allow paging set to true.

Thanks in advance.
 
P

Prasad

Hi

Use it like this :
int RowIndex = DataTable.Rows.Find(<args>)
int CurrentPage = RowIndex / grdSample.PageSize;
if(RowIndex % grdSample.PageSize != 0) CurrentPage++
grdSample.CurrentPageIndex = CurrentPage


HTH
Prasad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top