Click here to Skip to main content
13,701,732 members
Rate this:
 
Please Sign up or sign in to vote.
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
Posted 17-May-18 22:52pm
Updated 21-May-18 13:58pm
Comments
Richard Deeming 18-May-18 9:04am
   
If possible, I'd be inclined to ditch the GridView, and use something like DataTables:
Server-side processing | DataTables.net[^]

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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)[^]
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web06-2016 | 2.8.180906.1 | Last Updated 21 May 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100