I am not sure whether I understood your problem correctly. Assuming that you have the following situation:
1. You are uploading the file successfully using the FileUpload control.
2. You are able to save file data into database (Say, file name, size etc)
Now while you are trying to display the image button in the Grid View, you are trying to show the images as the Image button's background. But, for some reason, the image is not being shown for the image buttons.
If the above understanding is correct, here is what you need to work on:
An important issue is, where are you storing the file content. In the database? Or, in the file system.
Assumption1 : File content is stored the file system
--If you are storing the file content in the file system, then, either in the
"picture"
property of your object should have a correct URL value that points to the image within the web application folder, or, you should use a method that takes the
"picture"
property value as parameter and returns the relative URL of the image.
For example, suppose you storing the image
"profile.jpg"
as
"/images/profile.jpg"
within the web application folder. so, either the
"picture"
property of your object should contain the URL
"~/images/profile.jpg"
or you can call a method
GetImageUrl()
as follows:
Imageurl="<%# GetImageUrl(Eval ("picture")) %>"
where the method willl take just the
"profile.jpg"
as parameter and will return
"~/images/profile.jpg"
Good luck
Assumption2 : File content is stored in the database
--Well, in this case, you have to do a bit more work. You have to provide the
ImageUrl
property value as described above and then you have to create an
HttpHandler
that would handle any URL that has image file extension in the request file name and read and writes the file content in the output stream.
See an example HttpHandler here :
http://kurtschindler.net/blog/Post/Using-HttpHandlers-to-serve-image-files[
^]