Thursday, April 21, 2011

Image from dataset in ASP gridview

I receive a certain image name in a boundfield (i have two images in the same folder) and it comes from testing in the codebehind and binding a datatable into this gridview.

example: it comes as "image1.jpg" or "image2.jpg"

I'd like this text not to be displayed, instead, i want these images that are in /folder1/folder2 of my solution (i access images like this, and it works)

either i transform it into html tag...

<img src='/folder1/folder2/image1.jpg' border='0'>

(that's the reason for the first question i've made)

...OR I create an asp image somehow inside the boundfield.

Is there any way to do so ?

From stackoverflow
  • I've used:

    <asp:Literal runat="server" Text="<%#Eval("myField")%>" />
    

    Inside a templatefield

0 comments:

Post a Comment