hi, my next button works on the second click...eg:if i click next the page will just reload and then i click anything else on the page then the next button works same for previous.... really need some help this is the code i have ----------------------------------------------------------------------------------------------------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
p = 0
Session("p") = p 'p
End If
nsi = Session("nsi") 'no of images
lp = nsi / 15 'last page
Session("lp") = lp
pagechk()
p = Session("p")
lblpn.Text = p & "/" & lp
display()
End Sub
Dim j, x(15) As Int32
Private Sub pagechk()
lp = Session("lp")
p = Session("p")
If p = lp Then
btnnext.Enabled = False
btnprv.Enabled = True
If p > 0 Then
btnprv.Enabled = True
Else
btnprv.Enabled = False
End If
Else
btnnext.Enabled = True
If p > 0 Then
btnprv.Enabled = True
Else
btnprv.Enabled = False
End If
End If
End Sub
Private Sub display()
p = Session("p")
j = p * 15
For i As Int32 = 1 To 15
j += 1
x(i) = j
Next
imgsuits1.ImageUrl = "~/images/Suits thumbs/p" & x(1) & ".jpg"
imgsuits2.ImageUrl = "~/images/Suits thumbs/p" & x(2) & ".jpg"
imgsuits3.ImageUrl = "~/images/Suits thumbs/p" & x(3) & ".jpg"
imgsuits4.ImageUrl = "~/images/Suits thumbs/p" & x(4) & ".jpg"
imgsuits5.ImageUrl = "~/images/Suits thumbs/p" & x(5) & ".jpg"
imgsuits6.ImageUrl = "~/images/Suits thumbs/p" & x(6) & ".jpg"
imgsuits7.ImageUrl = "~/images/Suits thumbs/p" & x(7) & ".jpg"
imgsuits8.ImageUrl = "~/images/Suits thumbs/p" & x(8) & ".jpg"
imgsuits9.ImageUrl = "~/images/Suits thumbs/p" & x(9) & ".jpg"
imgsuits10.ImageUrl = "~/images/Suits thumbs/p" & x(10) & ".jpg"
imgsuits11.ImageUrl = "~/images/Suits thumbs/p" & x(11) & ".jpg"
imgsuits12.ImageUrl = "~/images/Suits thumbs/p" & x(12) & ".jpg"
imgsuits13.ImageUrl = "~/images/Suits thumbs/p" & x(13) & ".jpg"
imgsuits14.ImageUrl = "~/images/Suits thumbs/p" & x(14) & ".jpg"
imgsuits15.ImageUrl = "~/images/Suits thumbs/p" & x(15) & ".jpg"
End Sub
Protected Sub btnprv_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnprv.Click
p = Session("p")
p = p - 1
Session("p") = p
Session("bt") = 1
End Sub
Protected Sub btnnext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnext.Click
p = Session("p")
p = p + 1
Session("p") = p
Session("bt") = 1
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
If Session("bt") = 1 Then
Session("bt") = 0
Else
Session("p") = 0
Session("bt") = 0
End If
End Sub
|