469,931 Members | 1,831 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,931 developers. It's quick & easy.

Changing the imageurl of an imagemap control upon postback

Is there a way to change to swapimages for an imagemap in asp.net upon
postback on the server?

Thanks!
Feb 15 '08 #1
1 1772
Try something like the following:

If Me.Image1.ImageUrl = "images/image1.gif" Then Me.Image1.ImageUrl =
"images/image2.gif" Else Me.Image1.ImageUrl = "images/image2.gif"

It is important to make sure EnableViewState is set to True so that you can
determine the currently displayed ImageUrl. If you have more than one image
you want to loop through, you will need to modify the algorithm a little,
but the key is looking at the currently displayed ImageUrl. Another approach
would be to use a HiddenField control to keep track of the currently
displayed image, but this requires an extra control, so it is probably less
efficient.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"BillGatesFan" <kl******@hotmail.comwrote in message
news:d1**********************************@i7g2000p rf.googlegroups.com...
Is there a way to change to swapimages for an imagemap in asp.net upon
postback on the server?

Thanks!

Feb 15 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Adrian Parker | last post: by
1 post views Thread by Nathan Sokalski | last post: by
9 posts views Thread by Nathan Sokalski | last post: by
1 post views Thread by Jeff | last post: by
1 post views Thread by wardemon | last post: by
reply views Thread by DamienS | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.