I have a grid with a custom filter, like the sample in Gridview Custom filtering. How can I select the first row in the grid after the custom filter is applied?
I've tried this code, but didn't work:
Thanks in advance
I've tried this code, but didn't work:
Private Sub txtBuscar_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBuscar.TextChanged wFirstVisibleRow = -1 Me.gridArticulos.MasterTemplate.Refresh() If wFirstVisibleRow > 0 Then Dim wposcode As String = gridArticulos.MasterTemplate.Rows(wFirstVisibleRow).Cells(0).Value.ToString If wposcode <> "" Then Me.ArticulosSGFBindingSource.Position = Me.ArticulosSGFBindingSource.Find("CODIGO", wposcode) End If End If End Sub Private Sub gridArticulos_CustomFiltering(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCustomFilteringEventArgs) Handles gridArticulos.CustomFiltering If String.IsNullOrEmpty(Me.txtBuscar.Text) Then e.Visible = True For i As Integer = 0 To Me.gridArticulos.ColumnCount - 1 e.Row.Cells(i).Style.Reset() e.Row.InvalidateRow() Next Return End If e.Visible = False For i As Integer = 0 To Me.gridArticulos.ColumnCount - 1 If i <> 2 Then Dim text As String = e.Row.Cells(i).Value.ToString() If text.IndexOf(Me.txtBuscar.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0 Then e.Visible = True If wFirstVisibleRow = -1 Then wFirstVisibleRow = e.Row.Index End If e.Row.Cells(i).Style.CustomizeFill = True e.Row.Cells(i).Style.DrawFill = True e.Row.Cells(i).Style.BackColor = Color.FromArgb(201, 252, 254) Else e.Row.Cells(i).Style.Reset() e.Row.InvalidateRow() End If End If Next End SubThanks in advance