Click here to Skip to main content
15,847,750 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I want to filter my data grid view on writing text in textbox. i had put Autopostback=true but it is not working.
I wanna filter gridview without losing cursor from textbox.
when i leave textbox or press any keys like enter,TAB then grid view gets filtered.

How to do this without losing control from textbox.
Posted

1 solution

Define 'onkeyup' event for the textbox. Use txtB.Attributes.Add("onkeyup", "HandleMethodFilter();"); to add the event to textbox.

Now, in Javascript, define this method and use AJAX to get back the data based on the filter text. Show the data retrieved in Grid.
Overall, you would need client side code in order to keep the UI as is, keeping focus on textbox and updating gridview data.

Try!
 
Share this answer
 
Comments
husi.mak 23-Jul-12 12:54pm    
i dont know how to write in javascript.. and where to write this txtB.Attributes.Add("onkeyup","HandleMethodFilter();");....in code page??? or source page????
Sandeep Mewara 23-Jul-12 14:13pm    
In code behind page: txtB.Attributes.Add("onkeyup","HandleMethodFilter();");
In ASPX: function HandleMethodFilter();

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900