Helal Ismail
Helal Ismail

Reputation: 528

Image Binding in ASP.NET

I have the following piece of code

ImageUrl='<%# Bind("ImageUrl") %>'

I've got a GridView I want to show images on a ItemTemplate I have a Database where I'm saving on the name of the images e.g --> img1.jpg

I want to append the full path of the image at before its name so It can be viewed on the ItemTemplate on the GridView.

I tried to use concat, or the + operator but it doesn't seem to work can any1 tell me what 2 do ???

Upvotes: 0

Views: 2107

Answers (2)

bug finder
bug finder

Reputation: 1

Hi try this it ll works

' height="120" width="180" alt="" /> ' OnClick="BtnImg_Click" height="120" width="180"/>

Upvotes: 0

codeandcloud
codeandcloud

Reputation: 55298

Use inline Eval like this ImageUrl='<%# "path/to/image" + Bind("ImageUrl") %>'

No need to use Bind. Its used for two-way, read/write databinding.

Upvotes: 1

Related Questions