Results 1 to 1 of 1

Thread: ASP Imagemap click event only fires once

  1. #1
    danielsmith00 is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Apr 2012
    Posts
    1
    Reputation
    0

    ASP Imagemap click event only fires once

    I am trying to code a fairly simple web-app that displays full screen powerpoint slides that I have saved as PNG images. I want to be able to click the right half of the image to display the next slide in the rotation, and the left side of the image to move back a slide. I have this nearly working, when I click the right side of the picture, the image changes to the next slide in the rotation. But when I click it again, nothing happens. I can click the left side of the image, and the image changes back to the first slide, but again if I click the right side of the image again, it will advance one slide and no more.

    I can move back and forth between the first and second slides with no problem, but for some reason i can't get the array index (i2) to increment more than once with the click event?? I'm sure this is a fairly simple issue, i'm not really a programmer so I don't do this kind of thing every day.

    here's some of the code below:

    Dim LeftHotSpot As New RectangleHotSpot
    LeftHotSpot.Top = HeightInt
    LeftHotSpot.Bottom = 0
    LeftHotSpot.Left = 0
    LeftHotSpot.Right = WidthInt2
    LeftHotSpot.PostBackValue = "Left"
    LeftHotSpot.AlternateText = "Back"
    Dim RightHotSpot As New RectangleHotSpot
    RightHotSpot.Top = HeightInt
    RightHotSpot.Bottom = 0
    RightHotSpot.Left = WidthInt2
    RightHotSpot.Right = WidthInt
    RightHotSpot.PostBackValue = "Right"
    RightHotSpot.AlternateText = "Forward"
    htmlImage.HotSpots.Add(LeftHotSpot)
    htmlImage.HotSpots.Add(RightHotSpot)
    htmlImage.ImageUrl = "sales/1.Png"
    For Each FileName As String In System.IO.Directory.GetFiles(FolderPath)

    Position = InStr(FileName, ".")
    FileName = FileName.Substring(Position)
    FileArray(i) = i.ToString + ".png"

    i = i + 1

    Next
    i = i - 1
    htmlImage.ImageUrl = "sales/" & FileArray(0)
    End Sub

    Protected Sub Click_Back(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ImageMapEventArgs) Handles htmlImage.Click
    If e.PostBackValue = "Left" Then
    i2 = i2 - 1
    Else
    i2 = i2 + 1

    End If

    If i2 < 0 Or i2 > i Then
    i2 = 0
    End If
    htmlImage.ImageUrl = "sales/" + FileArray(i2)
    End Sub

    End Class
    Last edited by danielsmith00; 04-27-2012 at 3:48 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking