Problem Displaying Image in gridview

Discussion in 'ASP .Net' started by aSoundMind, May 6, 2007.

  1. aSoundMind

    aSoundMind Guest

    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.
    aSoundMind, May 6, 2007
    #1
    1. Advertising

  2. MasterGaurav \(www.edujini-labs.com\), May 6, 2007
    #2
    1. Advertising

  3. aSoundMind

    aSoundMind Guest

    On May 6, 10:25 pm, "MasterGaurav \(www.edujini-labs.com\)"
    <> wrote:
    > > 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.comwww.edujini-labs.comhttp://eduzine.edujini-labs.com
    > -----------------------------------------



    I am not sure, I am just using the code I found somewhere else. Any
    workarounds?
    aSoundMind, May 7, 2007
    #3
  4. > 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
    -----------------------------------------
    MasterGaurav \(www.edujini-labs.com\), May 8, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. http://www.visual-basic-data-mining.net/forum

    Displaying image after selecting an image file.

    http://www.visual-basic-data-mining.net/forum, Sep 15, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    338
    http://www.visual-basic-data-mining.net/forum
    Sep 15, 2004
  2. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    17,933
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
  3. Fonz
    Replies:
    1
    Views:
    879
    Alexey Smirnov
    Dec 18, 2009
  4. EdwardH

    Displaying an image within gridview

    EdwardH, Feb 2, 2008, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    161
    Gary Dunne
    Feb 5, 2008
  5. Ben
    Replies:
    5
    Views:
    268
Loading...

Share This Page