473,808 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Strin gWriter = New
System.IO.Strin gWriter
Dim htmlWrite As System.Web.UI.H tmlTextWriter = New
HtmlTextWriter( stringWrite)

Dim warnImage As New Image
warnImage = FormView1.FindC ontrol("warnImg ")
Dim path As String = ""
warnImage.Image Url = path

stringWrite.Wri te("<img src=" &
HttpContext.Cur rent.Request.Ur l.GetLeftPart(U riPartial.Autho rity) &
HttpContext.Cur rent.Request.Ap plicationPath & "/" & warnImage.Image Url
& " />")
warnImage.Rende rControl(htmlWr ite)

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 1466
Dim htmlWrite As System.Web.UI.H tmlTextWriter = 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, "MasterGaur av \(www.edujini-labs.com\)"
<gaurav.vaish.n os...@nospam.gm ail.comwrote:
Dim htmlWrite As System.Web.UI.H tmlTextWriter = 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
2641
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 as an image in a databound element, in this case I am resorting to Gridview although I would prefer datalist or something simpler. <code>
3
2524
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 except Picture. so i add a Imagefield to display images..but now i get cross icon.. below is the code. correct me where i am wrong....
2
2884
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. asp code... <asp:GridView ID="grdPics" runat="server" Height="136px" Style="z-index: 133; left: 32px; position: absolute; top: 600px" Width="464px" AutoGenerateColumns="False"> <Columns> <asp:ImageField...
3
3087
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 gridview with dataset. This dataset contains a colun called hasAttachments as true or false. Is it possible to display image in the image field? This image does not exsist in the database. I have image in the image folder in my application code. ...
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10631
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10374
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.