Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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...