Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

Sure, all you need to do is add this function, and call it as you will:

 

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

 

so you would say something like this on postback:

 

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

 

Good Luck!

Posted

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:

 

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

 

Take Care!

Brian

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...