On Oct 18, 5:48 pm, S_K <steve_kers...@yahoo.comwrote:
Hi,
I have a GridView that displays multiple pages.
I also have a TextBox where the user can input an ID (one of the
GridView column values).
I would like to use this TextBox.Text value to search the GridView for
that ID and set the
GridView.PageIndex so that this value is contained in the new page
that's now displayed.
There must be an easy way of doing this! Any ideas?
Thanks in advance.
Steve
Hi Steve
you can do something like this
-----------------------------------------------
Protected Sub BindGrid()
Dim dr As Data.DataSet = ...
Dim dv As New DataView()
dv = dr.Tables(0).DefaultView
If TextBox.Text.Length 0 Then
Dim i As Integer = dv.Find(tbSearch.Text)
If i >= 0 Then
GridView.CurrentPageIndex = i \ GridView.PageSize
GridView.SelectedIndex = i
Else
GridView.SelectedIndex = 0
End If
....