Help with filtering data in GridView based on data entered in a Textbox Textchanged event
Posted on 2011-09-22
I am trying the code below in the Textboxes' Textchanged event to filter the data displayed on a Grid based on the text entered in a Textbox. However the code is not working with the dataset (ds) in the filter satement. can you please help me fix this error. The code also doesn't trigger in the Textchange event is their a way to execute the code everytime the user enters a text?
Dim ds As New DataSet
GridView1.DataSource = ds.Tables(0)
Dim SearchCriteria As String
SearchCriteria = " Country IN (" & TextBox1.Text & " )"
Dim FilteredDT As DataTable
Dim DV As New DataView(ds, SearchCriteria, Nothing, DataViewRowState.CurrentRows) ***Error with ds in statement above
FilteredDT = DV.ToTable
GridView1.DataSource = FilteredDT