Last post Dec 31, 2018 08:00 AM by Sherry Chen
Dec 28, 2018 03:46 PM|TheUndertaker123|LINK
I've been doing some coding and I ran into a little issue. So, I have a model that contains a location string (e.g "\folder\file.png") and I am in need of injecting it into the CSS of an HTML tag (e.g <p style="background-image: url();">Text</p>), but no
matter how I try to do it, the backslashes simply get ignored (all of them) so basically the output always turns out to be "folderfile.png" instead of "\folder\file.png".
@Model.String simply ignores all the slashes, and I can't put another @ sign in front of it to tell the compiler to treat it like a location.
Putting the same code (@Model.String) inside an Image source (img src) tag works perfectly fine,
Dec 31, 2018 08:00 AM|Sherry Chen|LINK
Hi TheUndertaker123 ,
In HTML , the slash direction in the path is "/ ".
1. If you save the location string like "/folder/file.png" in the database , try to use
2. If you save the name of the location( file.png) in the database , try to use the helper
Best Regards ,