A
anand
Hello there,
Just a small problem while navigating datagrid, i am filling a datagrid by
output of query. i have given navigation buttons first,last, next,
previous.it is working but the problem is that i have to click twice to
navigate.any suggestion. i m using following code
Private Sub NavigationButtonClicked(ByVal sender As Object, _ByVal e As
EventArgs) Handles FirstPage.Click, PreviousPage.Click, NextPage.Click,
LastPage.Click Dim direction As String = CType(sender, Button).CommandName
Select Case direction.ToUpper() Case "FIRST"
DataGrid1.CurrentPageIndex = 0 Case "PREVIOUS"
DataGrid1.CurrentPageIndex = _ Math.Max(0,
DataGrid1.CurrentPageIndex - 1) Case "NEXT"
DataGrid1.CurrentPageIndex = _ Math.Min(DataGrid1.PageCount - 1,
_ DataGrid1.CurrentPageIndex + 1) Case "LAST"
DataGrid1.CurrentPageIndex = _ DataGrid1.PageCount - 1 Case
Else End Select DataGrid1.DataBind()End Sub
Just a small problem while navigating datagrid, i am filling a datagrid by
output of query. i have given navigation buttons first,last, next,
previous.it is working but the problem is that i have to click twice to
navigate.any suggestion. i m using following code
Private Sub NavigationButtonClicked(ByVal sender As Object, _ByVal e As
EventArgs) Handles FirstPage.Click, PreviousPage.Click, NextPage.Click,
LastPage.Click Dim direction As String = CType(sender, Button).CommandName
Select Case direction.ToUpper() Case "FIRST"
DataGrid1.CurrentPageIndex = 0 Case "PREVIOUS"
DataGrid1.CurrentPageIndex = _ Math.Max(0,
DataGrid1.CurrentPageIndex - 1) Case "NEXT"
DataGrid1.CurrentPageIndex = _ Math.Min(DataGrid1.PageCount - 1,
_ DataGrid1.CurrentPageIndex + 1) Case "LAST"
DataGrid1.CurrentPageIndex = _ DataGrid1.PageCount - 1 Case
Else End Select DataGrid1.DataBind()End Sub