Sub BindGrid()
Dim strError As String = ""
'strError = String.Format("Param: {0}",Param)
Try
'record the current row
Dim intRowIndex As Int32 = -1
Dim intScrollbarValue As Int32 = -1
'record the current row
Dim currRow As GridViewRowInfo = Nothing
currRow = DragAndDropGrid1.CurrentRow
If Not Me.DragAndDropGrid1.CurrentRow Is Nothing Then
intRowIndex = DragAndDropGrid1.Rows.IndexOf(DragAndDropGrid1.CurrentRow)
End If
'record the scrollbar position
intScrollbarValue = DragAndDropGrid1.TableElement.RowScroller.Scrollbar.Value
'rebind the grid
Me.DragAndDropGrid1.DataSource = DynData.SPs.FP_InboundFreightRequested(Me.ddlShow3.Text, appUser.Db).getTable
'if the grid is filtered, the ChildRows could be 0
If DragAndDropGrid1.MasterTemplate.ChildRows.Count > 0 Then
If intRowIndex = -1 Then
DragAndDropGrid1.MasterTemplate.ChildRows(0).IsCurrent = True
Else
If Not currRow Is Nothing Then
DragAndDropGrid1.GridNavigator.SelectRow(currRow)
'DragAndDropGrid1.GridNavigator.SelectNextRow(1)
Else
If intRowIndex < DragAndDropGrid1.Rows.Count() Then
DragAndDropGrid1.CurrentRow = DragAndDropGrid1.Rows(intRowIndex)
End If
End If
End If
End If
'put the scroll bar back
If intScrollbarValue > -1 Then
If intScrollbarValue < DragAndDropGrid1.TableElement.RowScroller.Scrollbar.Maximum Then
DragAndDropGrid1.TableElement.RowScroller.Scrollbar.Value = intScrollbarValue
End If
End If
Catch ex As Exception
ErrorHandler.globalErrorHandler(ex, strError, True)
End Try
End Sub