473,322 Members | 1,911 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Problem Displaying Image in gridview

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(UriPar tial.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.

May 6 '07 #1
3 1449
Dim htmlWrite As System.Web.UI.HtmlTextWriter = New
HtmlTextWriter(stringWrite)
I don't really understand why do you need a new HtmlTextWriter?
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
May 6 '07 #2
On May 6, 10:25 pm, "MasterGaurav \(www.edujini-labs.com\)"
<gaurav.vaish.nos...@nospam.gmail.comwrote:
Dim htmlWrite As System.Web.UI.HtmlTextWriter = New
HtmlTextWriter(stringWrite)

I don't really understand why do you need a new HtmlTextWriter?

--
Happy Hacking,
Gaurav Vaish |http://www.mastergaurav.comwww.eduji...ujini-labs.com
-----------------------------------------

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

May 7 '07 #3
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
-----------------------------------------
May 8 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: aabruzzese | last post by:
Hi folks, Been struggling with this little puzzle. I am reading the MemberInfo table for the ClubStarterKit, the table includes the Avatar for the User. I would like to display the Avatar...
3
by: velu | last post by:
Asp.Net 2 I am trying to display Image from Northwind Database. I ran a queary "SELECT CategoryID, CategoryName, Description, Picture FROM Categories" but the Dataview displayes all the fields...
2
by: Raiders8180 | last post by:
Hi, I'm new to the community (1st post) so I hope I didn't leave anything out. I have a gridview (grdPics) created with 1 Imagefiled (picname) which contains the URL to where the image is stored. ...
3
by: anjali5 | last post by:
Hello Everyone, I want to display an image in my gridview. The only thing is my datatabse table is returning true if there is an image and false if there is no image and I am binding my...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.