Problem Displaying Image in gridview

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • aSoundMind

    #1

    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.

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

    #2
    Re: Problem Displaying Image in gridview

    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


    -----------------------------------------


    Comment

    • aSoundMind

      #3
      Re: Problem Displaying Image in gridview

      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 |https://www.mastergaurav.comwww.eduj...ujini-labs.com
      -----------------------------------------

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

      Comment

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

        #4
        Re: Problem Displaying Image in gridview

        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


        -----------------------------------------


        Comment

        Working...