How to change the image button back to the previous image when user click the button again in asp.net using C# -


i creating seat reservation system, have seating chart in asp.net webpages. when user click on 1 of seat, change image.

i have did that. however, cannot figured out how if user click same seat again, image change previous image meaning user did not want reserve seat anymore.

any method can this? change image upon first click code below:

protected void imagebutton1_click(object sender, imageclickeventargs e) {     imagebutton1.imageurl = "seatreserved.png"; } 

thank if can me this.

you can use same code above, wrap in if statement:

protected void imagebutton1_click(object sender, imageclickeventargs e) {     if(imagebutton1.imageurl != "seatreserved.png")     {         imagebutton1.imageurl = "seatreserved.png";     }     else     {         imagebutton1.imageurl = "seatnotreserved.png";     } } 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -