locked
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

    ../Images/Products/ScentTower.png

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

    ../Images/Products/ScentTower%0d.png

    what is causing that?

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

    Wednesday, May 25, 2016 8:33 AM

Answers

  • User753101303 posted

    Hi,

    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