I am storing my image paths in a DB and am rendering them in a ListView.
<img src='<%# Eval("MainImagePath") %>' alt='<%# Eval("Title") %>' />
It’s not rendering because of backslashes. From the generated markup:
~\eventimages\23297700618245dcb46c7501574e3e94_placeholder2200x133.jpg
How can I use a string Replace method to generate this with forward slashes? I tried the answer here but couldn’t get it to work:
display image via imageurl in listview
UPDATE
I tried:
<img src='<%# Eval("MainImagePath").ToString().Replace("\", "/") %>'
alt='<%# Eval("Title") %>' />
…but got error “CS1010: Newline in constant”
try double slash it.