Hi..
i want to search record in gridview..
search output must be as you type..meaning that every keypress in textbox must produce outcome (result)..
could anyone help me please.......
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vishal JadavPosted Aug 2, 2010, 3:57 AM
Even i was facing same problem few days ago, coz i need to search in database which is a little time consuming, i thought its better to fine the perticular string in DATAGRIDVIEW.
I tried a lot and i got the solution at last.
In the Textchange event of ur searching textbox create a loop through rows of ur datagrid.
and try to find out using following method.
1. datagridview.rows[i].cells[0].value.contains(textToSearch) will give u text anywhere from ur cell
2. datagridview.rows[i].cells[0].value.startswith(textToSearch) will give u text starts with ur searching text
.
one more thing u need to do if u required is. try hiding those which fails in searching..
Be frank to ask anytime..
Best of luck..