Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. show image usin binding problem

show image usin binding problem

Scheduled Pinned Locked Moved ASP.NET
wpfwcfsysadmindockerhelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sepel
    wrote on last edited by
    #1

    hi i want to show my image using binding in a datalist: ImageUrl='<%#GetImgPicUrl(DataBinder.Eval(Container.DataItem, "url"))%>' runat="server" CssClass="newStyle1" /> and : public string GetImgPicUrl(object url) { string strUrl = Server.MapPath(@"~/Attachment/picture/" + url.ToString()); return strUrl; } it show image on my pc but on server it dosnt show. whats problem?

    sepel

    A A 2 Replies Last reply
    0
    • S sepel

      hi i want to show my image using binding in a datalist: ImageUrl='<%#GetImgPicUrl(DataBinder.Eval(Container.DataItem, "url"))%>' runat="server" CssClass="newStyle1" /> and : public string GetImgPicUrl(object url) { string strUrl = Server.MapPath(@"~/Attachment/picture/" + url.ToString()); return strUrl; } it show image on my pc but on server it dosnt show. whats problem?

      sepel

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      Is the picture in the correct location on the server? Check the path you are generating.

      Bob Ashfield Consultants Ltd

      1 Reply Last reply
      0
      • S sepel

        hi i want to show my image using binding in a datalist: ImageUrl='<%#GetImgPicUrl(DataBinder.Eval(Container.DataItem, "url"))%>' runat="server" CssClass="newStyle1" /> and : public string GetImgPicUrl(object url) { string strUrl = Server.MapPath(@"~/Attachment/picture/" + url.ToString()); return strUrl; } it show image on my pc but on server it dosnt show. whats problem?

        sepel

        A Offline
        A Offline
        AlexeiXX3
        wrote on last edited by
        #3

        sepel wrote:

        string strUrl = Server.MapPath(@"~/Attachment/picture/" + url.ToString());

        This return a local path as c:\... What you need is a web url like http://... Use this:

        ImageUrl='<%# Eval("url", "~/Attachment/picture/{0}")%>'
        or
        ImageUrl='< DataBinder.Eval(Container.DataItem, "url", "~/Attachment/picture/{0}"))%>'

        Alexei Rodriguez

        S 1 Reply Last reply
        0
        • A AlexeiXX3

          sepel wrote:

          string strUrl = Server.MapPath(@"~/Attachment/picture/" + url.ToString());

          This return a local path as c:\... What you need is a web url like http://... Use this:

          ImageUrl='<%# Eval("url", "~/Attachment/picture/{0}")%>'
          or
          ImageUrl='< DataBinder.Eval(Container.DataItem, "url", "~/Attachment/picture/{0}"))%>'

          Alexei Rodriguez

          S Offline
          S Offline
          sepel
          wrote on last edited by
          #4

          tnx.you are right. using server.Mappath return local path(e:\...).

          sepel

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups