Find Feature in DataGrid

H

Holysmoke

Hi,

I just like to implement a find feature in DataGrid. And the DataGrid is paged. I found some code sample to implement a search feature. It does n't help me because they Filter the Data and show the results on the datagrid.

I don't want to implement the Filter in SQL. Consider a DataGrid having 10 Pages and I have a string "Holysmokes" in Page 5. From Page 1 If i find a that string, I should go to Page 5 and not by filtering and showing the data. I just want to move the pointer. That's it. I see a Find method in DataView object which returns the row number but don't know how to use it with Paged DataGrid.

I appreciate your help,

TIA,
Holy
 
A

Alvin Bruney [MVP]

there's no easy way around it. use the filter method of either the dataview
or the dataset. when you find the item you will have to calculate what page
it is on and move the page index to the correct page. the calculation isn't
terribly difficult since you know the index it is in the container and how
many pages the grid contains as well as how many items fit on one page.
don't forget to include the last page since all rows do not necessarily fill
up the last page and it may throw your calculation off.
 

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

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top