C# Gridview and image field
-
If I have an image field in my gridview is there a way to tie it to a link so that it is clickable? I know there is the imagebutton column, but I don't see a way of populating the image from the database like I am doing with the image column. For example, I have a database with a column called "image" which has the relative path on my webserver to the image. Right now I am just binding the image column to the path for its imageurl field and I get the correct image to show. The problem is that I see no way of making it a link so that people can click on it. Alternately, I see no way of binding the imagebutton field to the database "image" column. Maybe I am just overlooking it?
-
If I have an image field in my gridview is there a way to tie it to a link so that it is clickable? I know there is the imagebutton column, but I don't see a way of populating the image from the database like I am doing with the image column. For example, I have a database with a column called "image" which has the relative path on my webserver to the image. Right now I am just binding the image column to the path for its imageurl field and I get the correct image to show. The problem is that I see no way of making it a link so that people can click on it. Alternately, I see no way of binding the imagebutton field to the database "image" column. Maybe I am just overlooking it?
Use a template column and wrap the image in a hyperlink control.
only two letters away from being an asset
-
Use a template column and wrap the image in a hyperlink control.
only two letters away from being an asset
I see the option to add a TemplateField, but I am not sure how to do the wrapping.
-
I see the option to add a TemplateField, but I am not sure how to do the wrapping.
-
If I have an image field in my gridview is there a way to tie it to a link so that it is clickable? I know there is the imagebutton column, but I don't see a way of populating the image from the database like I am doing with the image column. For example, I have a database with a column called "image" which has the relative path on my webserver to the image. Right now I am just binding the image column to the path for its imageurl field and I get the correct image to show. The problem is that I see no way of making it a link so that people can click on it. Alternately, I see no way of binding the imagebutton field to the database "image" column. Maybe I am just overlooking it?
-
The article you reference is completely off the topic and is no help at all in the problem at hand.
only two letters away from being an asset
-
It means, <a><img></img></a> I have mentioned the concept only. Use this format in your TemplateColumn
Regards, Jay :)
That doesn't seem to work because it adds the formatting inside the tag. So if I used your example it would do 
-
That doesn't seem to work because it adds the formatting inside the tag. So if I used your example it would do 
Ok I figured it out. Thanks for getting me thinking straight. I had to do it from a hyperlink field I changed the DataTextField to my image column in the database and then I used the DataTextFormatString