C# ASP.NET MVC Basics Modeling and Presenting Data Improving Our View Layout

Using Razor to render content in ASP.NET MVC Basics

Let's replace this text here the-amazing-spider-man-700.jpg <img src="/Images/the-amazing-spider-man-700.jpg"........

with @Model.CoverImageFileName. <img src="/Images/@Model.CoverImageFileName"......

Does not render the image in browser.

1 Answer

jonathan campbell
jonathan campbell
2,224 Points

I had the same issue...in my ComicBook.cs code I had:

return SeriesTitle.Replace("", "-").ToLower() + "-" + IssueNumber + ".jpg";

(no space in between first parameter of ...Replace function)

and changed it to:

return SeriesTitle.Replace(" ", "-").ToLower() + "-" + IssueNumber + ".jpg";

(with a space in between first parameter of ...Replace function)

Then code worked fine. Hope this helps....

PS its interesting that this reply was posted on the exact same day of the original post but exactly one year later...