Image/imagebutton server control Displays the local picture, realizes the idea is the database holds the picture the relative address, reads the address in the database, uses the control to load the display picture. The concrete implementation of the steps are referred to this article
The Image/imagebutton server control displays a local picture. Here, I do is: The database contains the relative address of the picture, read the address in the database, with the control to load the display picture.
Steps:
A, add a server control, where the image control is an example.
B, the path in the database, this is very important. The format I wrote was this: ~/image/1.jpg. I wrote before: ~\image\1.jpg, the picture shows that the load failed, changed the ' \ ' after, you can. Image is a folder that I've created in my project's home directory to specifically store pictures.
C, add code. To add a picture path using the ImageUrl property of Image:
Avatar image_portrait. ImageUrl = ds. Tables[zer]. Rows[zer][six]. ToString ();
D. Results