Image path have special characters when it's bind to gridview RRS feed

  • Question

  • User-172769993 posted

    I am trying to bind images to grid-view from path stored in database.

    lets say path stored in database is


    but when the image bind to grid view the path appears this format


    what is causing that?

    <asp:Image ID="imageControl"  runat="server" ImageUrl='<%# Eval("Picture") %>' />

    Wednesday, May 25, 2016 8:33 AM


  • User753101303 posted


    Seems you have an unwanted character "Carriage Return" control character in your stored string which is then encoded as %0D (see for example http://www.w3schools.com/tags/ref_urlencode.asp for url encoding).

    Is the image shown? If yes you may want to fix both the actual file name and your db data. If not more likely it is just an error in your data (something like UPDATE Picture SET picture=REPLACE(Picture,CHAR(13),'') WHERE Picture LIKE '%'+CHAR(13)+'%' would delete this character from all names having it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 25, 2016 10:57 AM