DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 22 Aug 2007 21:16:40 -0500,    posted on: microsoft.public.dotnet.framework.aspnet.webcontrols        back       

Thread Index
  1    Ross Culver


Arithmetic Overflow Error When Click 'Last' Page Button   
I get this error whenever a user clicks the 'last' page pager button on my 
gridview.  Below is the code behind the GridviewPageIndexChange

Dim ProviderCount As Integer = 0, PageNo As Integer = 0, PageCount As 
Integer = 0, PageIdx As Integer = 0
Try

ProviderCount = TotalRecords()

PageIdx = Me.gvQuickSearch.PageIndex.ToString

PageNo = PageIdx + 1

PageCount = Me.gvQuickSearch.PageCount

Select Case ProviderCount

Case 0

Me.txtMessage.Text = "There were no providers in the ElephantBridge database 
matching your keyword(s). Please double-check your spelling or try other 
keywords. You can also use our Advance Search for more search assistance."

Me.txtPageResults.Text = Nothing

Case 1

Me.txtMessage.Text = "There is only " & ProviderCount & " provider in the 
ElephantBridge database matching your selections."

Me.txtPageResults.Text = "Page 1 | Providers 1 of 1"

Case 2 To 11

Me.txtMessage.Text = "There are " & ProviderCount & " providers in the 
ElephantBridge database matching your keyword(s)."

Me.txtPageResults.Text = "Page " & PageNo & "| Providers 1-" & ProviderCount 
& " of " & ProviderCount

Case 11 To 2000

Me.txtMessage.Text = "There are " & ProviderCount & " providers in the 
ElephantBridge database matching your keyword(s)."

Select Case PageNo

Case 1

Me.txtPageResults.Text = "Page " & PageNo & "| Providers 1-10 of " & 
ProviderCount

Case 2 To PageCount - 1

Me.txtPageResults.Text = "Page " & PageNo & "| Providers " & ((PageNo - 1) * 
10) + 1 & "-" & ((PageNo - 1) * 10) + 10 & " of " & ProviderCount

Case PageCount

Me.txtPageResults.Text = "Page " & PageCount & "| Providers " & 
((PageCount - 1) * 10) + 1 & "-" & ProviderCount & " of " & ProviderCount

End Select

Case Is > 2000

Me.txtMessage.Text = "There are more than 2000 providers in the 
ElephantBridge database matching your keyword(s). To narrow your search, 
include additional keywords."

Select Case PageNo

Case 1

Me.txtPageResults.Text = "Page " & PageNo & "| Providers 1-10 of 2000"

Case 2 To PageCount - 1

Me.txtPageResults.Text = "Page " & PageNo & "| Providers " & ((PageNo - 1) * 
10) + 1 & "-" & ((PageNo - 1) * 10) + 10 & " of 2000"

Case PageCount

Me.txtPageResults.Text = "Page " & PageNo & "| Providers " & ((PageNo - 1) * 
10) + 1 & "- 2000 of 2000"

End Select

Case Else

Me.txtMessage.Text = "There were no providers in the ElephantBridge database 
matching your keyword(s). Please double-check your spelling or try other 
keywords. You can also use our Advance Search for more search assistance."

Me.txtPageResults.Text = Nothing

End Select

At first I thought it was due to a datatype in my formula, but then I noted 
that there's no error when I click the 'Next' pager button to page from the 
next-to-last page to the last page, which uses the exact same line of code.

I'm sure the problem is with the gridview page index, but why would the 
index be any different depending on whether you clicked the 'last' page 
button versus the 'next' page button from the next-to-last page?


Thanks,

Ross
Date:Wed, 22 Aug 2007 21:16:40 -0500   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us