Jump to content

Image control-How to change image at runtime ???


nobitavn94

Recommended Posts

If you have this in your aspx code:

<asp:Image ID="myImage" runat="server" AlternateText="My Image" ImageUrl="myImage.gif" />

Then you can change the ImageUrl in the codebehind with this:

myImage.ImageUrl = "myNewImage.gif";

Remember, however, that this would require a round trip (postback) to the server. If you don't want to do a round trip, you'll have to use client-side code (e.g. javascript).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...