Click here to Skip to main content
15,440,300 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey everyone,

I have a gridview and in the header I have textbox components used for filtering the data in the gridview.
AutoPostback and OnTextChanged events are set. So when I enter text and press TAB the event is executed and my gridview shows filtered data. My datasource is a DataView object.

What I want is that while typing the text in a textbox the rows with the filtertext are only shown (DataView.RowFilter is set) so I don't have to TAB.

I have created an ASHX. I can get my data from the Cache. I can create a DataView with the RowFilter, but how to update my Gridview?

What I have tried:

I tried with onkeyup event, but it executed TextChanged event by an __dopostback javascript call.
In that case the grid is fully reloaded and that can be seen on the page despite the gridview is in an UpdatePanel
Updated 21-May-18 13:58pm
Richard Deeming 18-May-18 9:04am     CRLF
If possible, I'd be inclined to ditch the GridView, and use something like DataTables: Server-side processing |[^]

1 solution

Things will get more complicated if you try to combine server-side controls with client-side functionality. GridView is a server-side data control which provides server-side capabilities that you can take advantage of. If you want manipulate the data in GridView at the client (JavaScript) then you'll have to learn JavaScript to manipulate the DOM (HTML elements). You could try looking at jQuery as it provides selectors that you can use to manipulate the DOM and it also provides AJAX APIs that enables you to communicate with your server data asynchronously. But be aware that this may take you alot of time and effort if you are not familiar with client-side scripting.

You other option would be to use a pre-cooked client-side grid that does all the basic things you need for your grid. One good example is using Bootstrap DataTables. See this for demo: DataTables example - Individual column searching (text inputs)[^]
Share this answer

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