Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple ImageButton Problem

Status
Not open for further replies.

thefox149

Technical User
Nov 22, 2004
158
AU
Simple I have some imagebutton simulating a tab on a masterpage. When the user clicks the button I take them to another page and wit the code behind I change the imageurl but nothing happens....

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Page.IsPostBack = False Then
homeImageButton.ImageUrl = "Pics/homewhite.jpg"
productsImageButton.ImageUrl = "Pics/productsgray.jpg"
contactImageButton.ImageUrl = "Pics/contactgray.jpg"

End If

End Sub

Protected Sub productsImageButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles productsImageButton.Click

homeImageButton.ImageUrl = "Pics/homegray.jpg"
productsImageButton.ImageUrl = "Pics/productswhite.jpg"
contactImageButton.ImageUrl = "Pics/contactgray.jpg"
Server.Transfer("Products.aspx")
End Sub

My cat's name is sprinkles
-Ralph Wigam
 
Your code is working fine at my side. What is the exact problem at your side? Is 'Products.aspx' there?

Sharing the best from my side...

--Prashant--
 
I didn't explain myself correctly. The images do not change. When I remove the server.transfer the images do not change

My cat's name is sprinkles
-Ralph Wigam
 
I checked that thing on that day only. Removing the Server.Transfer changes the images at my side. As the Page.IsPostBack returns false initially, it changes the position of images. Next time it returns True. So this will not change any image position.


Sharing the best from my side...

--Prashant--
 
damn another typing mistake when removing server.transfer the code works and the imagebutton image does indeed change.

add server.transfer and it stops it's almost as if it stops downloading the new image

My cat's name is sprinkles
-Ralph Wigam
 
ok...so finally you are done with it...Great...

Sharing the best from my side...

--Prashant--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top