Datagrid Paging Question

lorena

Centurion
Joined
Oct 23, 2003
Messages
134
Location
Phoenix, Arizona
I have a series of pages that display closed files in different folders. Some of the folders have many files and some have few.
Is it possible to create an event that displays or hides the Pager based on the file count?
Thanks in advance
 
Sure, all you need to do is add this function, and call it as you will:

Visual Basic:
    Private Sub GridPagerVisibility(ByVal ShowHide As Boolean)
        Me.DataGrid1.PagerStyle.Visible = ShowHide
    End Sub

so you would say something like this on postback:

Visual Basic:
    if myFileCount < 100 Then
       GridPagerVisibility(False)
    else
       GridPagerVisibility(True)
    end if

Good Luck!
 
Glad it worked and that I could help out!


I was also thinking, if you wanted to get crazy you could have the datagrid be passed into the function as well:

Visual Basic:
Private Sub GridPagerVisibility(ByVal ShowHide As Boolean, byref dg1 as System.Web.UI.WebControls.DataGrid)
        dg1.PagerStyle.Visible = ShowHide
End Sub

Take Care!
Brian
 
Back
Top