Setting the Image control properties programmatically in C#

The Image control can be used to display an image on a webpage. The Image control is represented as the element in the source and has no
content embedded between its opening and closing tags.

protected void Page_Load(object sender, EventArgs e)  
{  
  Image1.ImageUrl= "~/images/mypic.jpg"; 
  Image1.DescriptionUrl= "~/mypicImageDescription.htm"; 
  Image1.AlternateText = "This is a picture of me"; 
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.