Problem Displaying Image in gridview

A

aSoundMind

Hello Guys,

I am not sure is this a common problem. I can't display image which in
a gridview to excel or word. I have not try on pdf or web but surely
this annoy me.

I tried to google it and the best I can found is this code which
mentioned something tat it is due to excel limitation and so we need
to use absolute path.

So here is the code, which I modified a bit to match my code.

Dim stringWrite As System.IO.StringWriter = New
System.IO.StringWriter
Dim htmlWrite As System.Web.UI.HtmlTextWriter = New
HtmlTextWriter(stringWrite)

Dim warnImage As New Image
warnImage = FormView1.FindControl("warnImg")
Dim path As String = ""
warnImage.ImageUrl = path

stringWrite.Write("<img src=" &
HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) &
HttpContext.Current.Request.ApplicationPath & "/" & warnImage.ImageUrl
& " />")
warnImage.RenderControl(htmlWrite)

So I tried tat code and still the image is not shown. No error
whatsoever. I appreciate any help. Thanks in advance.
 
M

MasterGaurav \(www.edujini-labs.com\)

I am not sure, I am just using the code I found somewhere else. Any
workarounds?

Hmmm... don't know what the code is actually all about!
I am not sure is this a common problem. I can't display image which in
a gridview to excel or word. I have not try on pdf or web but surely
this annoy me.

Can you please explain what exactly you are looking for.
I could not understand "I can't display image which in a gridview to excel
or word".

My understanding is:
You want to display an image + some text in each cell in grid-view.

Let me know if what I think is correct.


--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top