I want to enable choosing which image to display after a button click.

Could you please give me an example?

Thanks

This is what I have so far :

protected void Button10_Click(object sender, EventArgs e)
  {
  Image1.ImageUrl = @"C:\img\Desert.jpg";
  Image1.ImageAlign = ImageAlign.Left;
 }

It won't display anything after I run it.

The images that I want to display are saved on my local disk C, so ImageUri probably doesn't work because of that.

Does anyone have an idea how to display an image in this situation?

Thanks*

Recommended Answers

All 4 Replies

Are you using xaml or normal windows forms?

Try using pictureBox1.Image = Image.FromFile("c:\filename.jpg"); try this link: Click Here

I have to use a web form, and there in no picture box available in web forms

string imgurl;

protected void Button10_Click(object sender, EventArgs e)
 {
 Image1.ImageUrl = imgurl;
 Image1.ImageAlign = ImageAlign.Left;
 }

So something like <image src=""...
is not an option for me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.